linkedin post content edit mode

This commit is contained in:
Faheed 2025-10-27 19:33:53 +03:00
parent 99643eb08c
commit f9aaaeb788
9 changed files with 65 additions and 3 deletions

View File

@ -629,7 +629,11 @@ class JobPostingStatusForm(forms.ModelForm):
widgets = {
'status': forms.Select(attrs={'class': 'form-select'}),
}
class LinkedPostContentForm(forms.ModelForm):
class Meta:
model = JobPosting
fields = ['linkedin_post_formated_data']
class FormTemplateIsActiveForm(forms.ModelForm):
class Meta:
model = FormTemplate

View File

@ -509,7 +509,7 @@ def handle_zoom_webhook_event(payload):
# We rely on the unique 'id' that maps to your ZoomMeeting.meeting_id field.
meeting_id_zoom = str(object_data.get('id'))
print(meeting_id_zoom)
if not meeting_id_zoom:job_posting.application_url}"
if not meeting_id_zoom:
logger.warning(f"Webhook received without a valid Meeting ID: {event_type}")
return False

View File

@ -65,7 +65,8 @@ urlpatterns = [
path('forms/builder/<slug:template_slug>/', views.form_builder, name='form_builder'),
path('forms/', views.form_templates_list, name='form_templates_list'),
path('forms/create-template/', views.create_form_template, name='create_form_template'),
path('jobs/<slug:slug>/edit_linkedin_post_content/',views.edit_linkedin_post_content,name='edit_linkedin_post_content'),
path('jobs/<slug:slug>/candidate_screening_view/', views.candidate_screening_view, name='candidate_screening_view'),
path('jobs/<slug:slug>/candidate_exam_view/', views.candidate_exam_view, name='candidate_exam_view'),
path('jobs/<slug:slug>/candidate_interview_view/', views.candidate_interview_view, name='candidate_interview_view'),

View File

@ -33,6 +33,7 @@ from .forms import (
StaffUserCreationForm,
MeetingCommentForm,
ToggleAccountForm,
LinkedPostContentForm
)
from easyaudit.models import CRUDEvent, LoginEvent, RequestEvent
@ -343,6 +344,7 @@ def job_detail(request, slug):
offer_count = applicants.filter(stage="Offer").count()
status_form = JobPostingStatusForm(instance=job)
linkedin_content_form=LinkedPostContentForm(instance=job)
try:
# If the related object exists, use its instance data
image_upload_form = JobPostingImageForm(instance=job.post_images)
@ -471,6 +473,7 @@ def job_detail(request, slug):
'high_potential_ratio': high_potential_ratio,
'avg_t2i_days': avg_t2i_days,
'avg_t_in_exam_days': avg_t_in_exam_days,
'linkedin_content_form':linkedin_content_form
}
return render(request, "jobs/job_detail.html", context)
@ -508,6 +511,30 @@ def job_image_upload(request, slug):
return redirect('job_detail', slug=job.slug)
@login_required
def edit_linkedin_post_content(request,slug):
job=get_object_or_404(JobPosting,slug=slug)
linkedin_content_form=LinkedPostContentForm(instance=job)
if request.method=='POST':
linkedin_content_form=LinkedPostContentForm(request.POST,instance=job)
if linkedin_content_form.is_valid():
linkedin_content_form.save()
messages.success(request,"Linked post content updated successfully!")
return redirect('job_detail',job.slug)
else:
messages.error(request,"Error update the Linkedin Post content")
return redirect('job_detail',job.slug)
else:
linkedin_content_form=LinkedPostContentForm()
return redirect('job_detail',job.slug)
def kaauh_career(request):
active_jobs = JobPosting.objects.select_related(
'form_template'

View File

@ -356,6 +356,8 @@
{% endif %}
{% endif %}
</div>
</div>
@ -404,6 +406,11 @@
<small>{% trans "Error:" %} {{ job.linkedin_post_status }}</small>
</div>
{% endif %}
{% if job.linkedin_post_formated_data %}
<button type="button" class="btn btn-main-action w-100" data-bs-toggle="modal" data-bs-target="#linkedinData">
<i class="fas fa-edit me-1"></i> {% trans "Update LinkedIn Content" %}
</button>
{% endif %}
</div>
</div>
</div>
@ -499,6 +506,7 @@
</div>
</div>
{% include "jobs/partials/image_upload.html" %}
{% include "jobs/partials/linkedin_content_form.html"%}
<div class="modal fade" id="editStatusModal" tabindex="-1" aria-labelledby="editStatusModalLabel" aria-hidden="true">
<div class="modal-dialog">

View File

@ -0,0 +1,22 @@
{% load crispy_forms_tags %}
<div class="modal fade mt-4" id="linkedinData" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Edit linkedin Post content</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form method="post" action="{% url 'edit_linkedin_post_content' job.slug %}" enctype="multipart/form-data" >
{% csrf_token %}
{{ linkedin_content_form|crispy }}
<div class="modal-footer mt-2">
<button type="button" class="btn btn-lg btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-main-action ">Save changes</button>
</div>
</form>
</div>
</div>
</div>
</div>