Compare commits

...

2 Commits

Author SHA1 Message Date
f9aaaeb788 linkedin post content edit mode 2025-10-27 19:33:53 +03:00
99643eb08c missing details 2025-10-27 17:56:41 +03:00
9 changed files with 75 additions and 5 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

@ -137,12 +137,17 @@ def format_job_description(pk):
**HASHTAGS: for search and reach:**
{job_posting.hash_tags}
**APPLICATION URL: for career page only if it is provided**
{job_posting.application_url}
---
**TASK 1: HTML Formatting (Two Blocks)**
1. **Format the Job Description:** Organize and format the raw JOB DESCRIPTION and BENEFITS data into clear, readable sections using `<h2>` headings and `<ul>`/`<li>` bullet points. Encapsulate the entire formatted block within a single `<div>`.
2. **Format the Qualifications:** Organize and format the raw QUALIFICATIONS data into clear, readable sections using `<h2>` headings and `<ul>`/`<li>` bullet points. Encapsulate the entire formatted block within a single `<div>`.
2. **Format the Requirements:** Organize and format the raw Requirements data into clear, readable sections using `<h2>` headings and `<ul>`/`<li>` bullet points. Encapsulate the entire formatted block within a single `<div>`.
3. **Format the Benefits:** Organize and format the raw Requirements data into clear, readable sections using `<h2>` headings and `<ul>`/`<li>` bullet points. Encapsulate the entire formatted block within a single `<div>`.
4. **Application Instructions:** Organize and format the raw Requirements data into clear, readable sections using `<h2>` headings and `<ul>`/`<li>` bullet points. Encapsulate the entire formatted block within a single `<div>`.
**TASK 2: LinkedIn Post Creation**
1. **Write the Post:** Create an engaging, professional, and concise LinkedIn post (maximum 1300 characters) summarizing the opportunity.
@ -158,8 +163,9 @@ def format_job_description(pk):
**Output Keys:**
1. `html_job_description`
2. `html_qualifications`
3 `html_job_requirements`
4. `linkedin_post_data`
3. 'html_benefits'
4. 'html_application_instructions'
5. `linkedin_post_data`
**Do not include any other text, explanation, or markdown outside of the final JSON object.**
"""
@ -176,6 +182,8 @@ def format_job_description(pk):
job_posting.description = data.get('html_job_description')
job_posting.qualifications = data.get('html_qualifications')
job_posting.benefits=data.get('html_benefits')
job_posting.application_instructions=data.get('html_application_instruction')
job_posting.linkedin_post_formated_data=data.get('linkedin_post_data')
job_posting.save(update_fields=['description', 'qualifications','linkedin_post_formated_data'])

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>