diff --git a/.env b/.env deleted file mode 100644 index 8d7fbd5..0000000 --- a/.env +++ /dev/null @@ -1,3 +0,0 @@ -DB_NAME=haikal_db -DB_USER=faheed -DB_PASSWORD=Faheed@215 \ No newline at end of file diff --git a/recruitment/__pycache__/forms.cpython-312.pyc b/recruitment/__pycache__/forms.cpython-312.pyc index c933fed..1bfac84 100644 Binary files a/recruitment/__pycache__/forms.cpython-312.pyc and b/recruitment/__pycache__/forms.cpython-312.pyc differ diff --git a/recruitment/__pycache__/views.cpython-312.pyc b/recruitment/__pycache__/views.cpython-312.pyc index a41a4aa..3a494ac 100644 Binary files a/recruitment/__pycache__/views.cpython-312.pyc and b/recruitment/__pycache__/views.cpython-312.pyc differ diff --git a/recruitment/views.py b/recruitment/views.py index 5b09078..6a5a7b9 100644 --- a/recruitment/views.py +++ b/recruitment/views.py @@ -5445,25 +5445,50 @@ def candidate_signup(request, slug): from .forms import InterviewParticpantsForm +# def create_interview_participants(request, slug): +# schedule_interview = get_object_or_404(ScheduledInterview, slug=slug) +# interview_slug = schedule_interview.zoom_meeting.slug +# if request.method == "POST": +# form = InterviewParticpantsForm(request.POST, instance=schedule_interview) +# if form.is_valid(): +# # Save the main Candidate object, but don't commit to DB yet +# candidate = form.save(commit=False) +# candidate.save() +# # This is important for ManyToMany fields: save the many-to-many data +# form.save_m2m() +# return redirect( +# "meeting_details", slug=interview_slug +# ) # Redirect to a success page +# else: +# form = InterviewParticpantsForm(instance=schedule_interview) + +# return render( +# request, "interviews/interview_participants_form.html", {"form": form} +# ) + def create_interview_participants(request, slug): + """ + Manage participants for a ScheduledInterview. + Uses interview_pk because ScheduledInterview has no slug. + """ schedule_interview = get_object_or_404(ScheduledInterview, slug=slug) - interview_slug = schedule_interview.zoom_meeting.slug + + # Get the slug from the related InterviewLocation (the "meeting") + meeting_slug = schedule_interview.interview_location.slug # ✅ Correct + if request.method == "POST": form = InterviewParticpantsForm(request.POST, instance=schedule_interview) if form.is_valid(): - # Save the main Candidate object, but don't commit to DB yet - candidate = form.save(commit=False) - candidate.save() - # This is important for ManyToMany fields: save the many-to-many data - form.save_m2m() - return redirect( - "meeting_details", slug=interview_slug - ) # Redirect to a success page + form.save() # No need for commit=False — it's not a create, just update + messages.success(request, "Participants updated successfully.") + return redirect("meeting_details", slug=meeting_slug) else: form = InterviewParticpantsForm(instance=schedule_interview) return render( - request, "interviews/interview_participants_form.html", {"form": form} + request, + "interviews/interview_participants_form.html", + {"form": form, "interview": schedule_interview} ) @@ -5867,6 +5892,8 @@ def meeting_details(request, slug): # Forms for modals participant_form = InterviewParticpantsForm(instance=interview) + + # email_form = InterviewEmailForm( # candidate=candidate, # external_participants=external_participants, # QuerySet of Participants diff --git a/templates/interviews/detail_interview.html b/templates/interviews/detail_interview.html index 0739575..0505f4d 100644 --- a/templates/interviews/detail_interview.html +++ b/templates/interviews/detail_interview.html @@ -362,7 +362,7 @@ body { background-color: #f0f2f5; font-family: 'Inter', sans-serif; }