meetings_detail chnages
This commit is contained in:
parent
506766b6ca
commit
3934d1cebe
Binary file not shown.
Binary file not shown.
@ -5445,25 +5445,50 @@ def candidate_signup(request, slug):
|
|||||||
from .forms import InterviewParticpantsForm
|
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):
|
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)
|
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":
|
if request.method == "POST":
|
||||||
form = InterviewParticpantsForm(request.POST, instance=schedule_interview)
|
form = InterviewParticpantsForm(request.POST, instance=schedule_interview)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
# Save the main Candidate object, but don't commit to DB yet
|
form.save() # No need for commit=False — it's not a create, just update
|
||||||
candidate = form.save(commit=False)
|
messages.success(request, "Participants updated successfully.")
|
||||||
candidate.save()
|
return redirect("meeting_details", slug=meeting_slug)
|
||||||
# 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:
|
else:
|
||||||
form = InterviewParticpantsForm(instance=schedule_interview)
|
form = InterviewParticpantsForm(instance=schedule_interview)
|
||||||
|
|
||||||
return render(
|
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
|
# Forms for modals
|
||||||
participant_form = InterviewParticpantsForm(instance=interview)
|
participant_form = InterviewParticpantsForm(instance=interview)
|
||||||
|
|
||||||
|
|
||||||
# email_form = InterviewEmailForm(
|
# email_form = InterviewEmailForm(
|
||||||
# candidate=candidate,
|
# candidate=candidate,
|
||||||
# external_participants=external_participants, # QuerySet of Participants
|
# external_participants=external_participants, # QuerySet of Participants
|
||||||
|
|||||||
@ -362,7 +362,7 @@ body { background-color: #f0f2f5; font-family: 'Inter', sans-serif; }
|
|||||||
<h5 class="modal-title">{% trans "Manage all participants" %}</h5>
|
<h5 class="modal-title">{% trans "Manage all participants" %}</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="{% url 'create_interview_participants' interview.pk %}">
|
<form method="post" action="{% url 'create_interview_participants' interview.slug %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
{{ form.participants.errors }}
|
{{ form.participants.errors }}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user