From dc45b81c87356a6214e08a55fde4d60c8d70b5ce Mon Sep 17 00:00:00 2001 From: Ali Nabhan Aboobakuru <Ali3.Aboobakuru@live.uwe.ac.uk> Date: Mon, 9 Dec 2024 22:50:28 +0500 Subject: [PATCH] views.py thingy updated views.py I mean sorry --- accounts/__pycache__/views.cpython-311.pyc | Bin 23203 -> 21917 bytes accounts/views.py | 75 ++++++++------------- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/accounts/__pycache__/views.cpython-311.pyc b/accounts/__pycache__/views.cpython-311.pyc index 797b715a06bc0fc36d4e52386f3210141620a5c4..14030175028a6b90eaebe13e1948a7de9db9daa2 100644 GIT binary patch delta 2000 zcmZ3ym2vKBM!w~|yj%<n3=B>>;pw04C-O<u|6yccn9h*GkiwY5kjogwn9CH!l*=5& z%m@-=%3;Z6jbh7XkK)MXjN$}~G3RjQaz}B4*(^Ccxx7)lU^Z(GUoL+XKbXyyBakZ? zC73G|B?RWP=LqMDM2Rpmq;RBg=7{EsMTzB#M~UZ3MAb{=N=8ZMN<~S5CAo5>b7i7r za%H1rbLFDsa^<7sa}}Z#z=m+=C`Ku!Fr@J0DCH_gDKj#p@U}2Ssig9z@U<{3V_;xd z4e}WnN2#Xrrto8ks-^O#2%w7AGcZJ{rwFz%L}{e*rU;=*GB8AGrt+o;V~A>{@}`Jj zh-#<urifyQ>ZFLZFhuF5h_^6A>7_`tFhuF6@}@{a)zyRD3nHQnQh8IPpu!*lFpe@z z<xP>s5H(8WO_9M6HBRMCk;M=-N##wE!w@x1k#Av$GBZly4rb6)cnPvhllc}~QEFaF zYSAr@qSTbkqSWM)TY~ASCGq)5S*gh-@%csZCI%*xby@Um`Ev5pGxOq$QVUBni&9fG z8E^5p<|bz5_@)*YC#I)rGTq|wD$dUfN-ZwP&nr&7#p9NllM3Taj$mnEWS#t)Mcd?- zh<{#EeqvEdW?p)5X;N-xadBpT-Yo&I{G{O2)a=xvfTH}g%$!s|O~za7PL(C8#h(6? z7wCv>zR9|fkx_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X8gc_M3yjO zT81U&KyGDWbe(J)lA9^Tz^I2KWf@;!KtWhcLd_8u7!+?X*j>PeKCnz)9g<dW#K35I zfx!Y3VWvCG)Bp}+ZbtbJ4BU+J@Gu4m$YJv~dL9CWx<ROv9v=gv`2_|uOoVCU4MzUS nexZ^Mj8>3b04KptVPj<fz`(}H4tEMjKnOEVKd?-043z-@q}x5- diff --git a/accounts/views.py b/accounts/views.py index 6569e037..4287312e 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,33 +1,30 @@ -from django.shortcuts import render, redirect -from django.contrib.auth import login as auth_login, logout as auth_logout, authenticate -from django.contrib import messages -from django.db import transaction -from .forms import JobSeekerRegisterForm, EmployerRegisterForm, ProfileEditForm, EmployerProfileForm, JobSeekerProfileForm -from django.contrib.auth.decorators import login_required -from .models import Notification, CustomUser, EmployerProfile -from django.http import JsonResponse -from django.shortcuts import render, redirect -from django.contrib import messages -from .forms import JobSeekerProfileForm -from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect, get_object_or_404 -from django.core.mail import EmailMessage # For sending via email -from .models import EmployerProfile, OnboardingSubmission +from django.contrib.auth import login as auth_login, logout as auth_logout, authenticate from django.contrib import messages -import zipfile -from io import BytesIO -from django.http import JsonResponse from django.contrib.auth.decorators import login_required -from .models import Notification -from django.http import FileResponse +from django.core.mail import EmailMessage +from django.http import JsonResponse, FileResponse +from django.db import transaction + +from .forms import ( + JobSeekerRegisterForm, + EmployerRegisterForm, + ProfileEditForm, + EmployerProfileForm, + JobSeekerProfileForm, +) +from .models import ( + Notification, + CustomUser, + EmployerProfile, + OnboardingSubmission, + JobSeekerProfile, +) + import zipfile from io import BytesIO -from django.shortcuts import render, redirect, get_object_or_404 -from .models import EmployerProfile -from django.contrib import messages -from django.shortcuts import render -from .models import Notification, JobSeekerProfile + def message_box(request): notifications = Notification.objects.select_related('user').all() @@ -46,8 +43,6 @@ def message_box(request): -from django.http import JsonResponse -from django.shortcuts import redirect @login_required def delete_notification(request, notification_id): @@ -67,7 +62,7 @@ def delete_notification(request, notification_id): return redirect("message_box") -from django.contrib import messages + @login_required def handle_notification_response(request, notification_id, action): @@ -94,8 +89,7 @@ def handle_notification_response(request, notification_id, action): -from django.http import JsonResponse -from django.shortcuts import redirect + @login_required def mark_notification_as_read(request, notification_id): @@ -175,8 +169,7 @@ def onboarding_form(request, employer_id): -from django.shortcuts import render -from .models import EmployerProfile + @login_required def job_list(request): """View to display the list of employers.""" @@ -265,11 +258,7 @@ def employer_profile_edit(request): return render(request, 'accounts/employer_profile_edit.html', {'form': form}) -from django.shortcuts import render, redirect -from django.contrib.auth import login as auth_login -from django.contrib import messages -from django.db import transaction -from .forms import JobSeekerRegisterForm, EmployerRegisterForm + def register(request): """Handles both Job Seeker and Employer registration dynamically.""" @@ -373,9 +362,7 @@ def send_notification(request, candidate_id): return JsonResponse({'status': 'error', 'message': 'Invalid request method.'}, status=405) -from django.shortcuts import redirect, get_object_or_404 -from django.contrib.auth.decorators import login_required -from .models import JobSeekerProfile + @login_required def toggle_full_details_visibility(request): @@ -393,8 +380,7 @@ def toggle_full_details_visibility(request): -from django.shortcuts import render -from .models import JobSeekerProfile + @login_required def candidate_list(request): @@ -404,8 +390,7 @@ def candidate_list(request): return render(request, 'candidatelist.html', {'candidates': candidates}) -from django.shortcuts import render, get_object_or_404 -from .models import JobSeekerProfile + @login_required def candidate_details(request, candidate_id): """Displays the details of a specific candidate.""" @@ -422,8 +407,6 @@ def candidate_details(request, candidate_id): -#View to Fetch Notifications -from django.contrib.auth.decorators import login_required @login_required def notifications(request): @@ -434,8 +417,6 @@ def notifications(request): 'unread_notifications': unread_notifications }) -#AJAX Endpoint for Real-Time Updates: -from django.http import JsonResponse def fetch_notifications(request): if not request.user.is_authenticated: -- GitLab