meetings_detail chnages

This commit is contained in:
Faheed 2025-11-19 12:56:03 +03:00
parent 506766b6ca
commit 3934d1cebe
5 changed files with 38 additions and 14 deletions

3
.env
View File

@ -1,3 +0,0 @@
DB_NAME=haikal_db
DB_USER=faheed
DB_PASSWORD=Faheed@215

View File

@ -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

View File

@ -362,7 +362,7 @@ body { background-color: #f0f2f5; font-family: 'Inter', sans-serif; }
<h5 class="modal-title">{% trans "Manage all participants" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form method="post" action="{% url 'create_interview_participants' interview.pk %}">
<form method="post" action="{% url 'create_interview_participants' interview.slug %}">
{% csrf_token %}
<div class="modal-body">
{{ form.participants.errors }}