django summernote added

This commit is contained in:
Faheed 2025-10-08 14:58:19 +03:00
parent f02d859c7a
commit 3b8ed4c93b
11 changed files with 547 additions and 520 deletions

View File

@ -48,6 +48,7 @@ INSTALLED_APPS = [
'channels',
'django_filters',
'crispy_forms',
'django_summernote',
'crispy_bootstrap5',
'django_extensions',
'template_partials',

View File

@ -16,7 +16,8 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include(router.urls)),
path('accounts/', include('allauth.urls')),
path('i18n/', include('django.conf.urls.i18n')),
path('i18n/', include('django.conf.urls.i18n')),
path('summernote/', include('django_summernote.urls')),
]
# 2. URLs that DO have a language prefix (user-facing views)

Binary file not shown.

View File

@ -1,10 +1,12 @@
from django import forms
from .validators import validate_hash_tags
from crispy_forms.helper import FormHelper
from django.core.validators import URLValidator
from django.utils.translation import gettext_lazy as _
from crispy_forms.layout import Layout, Submit, HTML, Div, Field
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Row, Column, Field, Div
from .models import ZoomMeeting, Candidate,TrainingMaterial,JobPosting,FormTemplate,InterviewSchedule
from django_summernote.widgets import SummernoteWidget
class CandidateForm(forms.ModelForm):
class Meta:
@ -150,28 +152,33 @@ class TrainingMaterialForm(forms.ModelForm):
'file': _('File'),
}
widgets = {
'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': _('Enter title')}),
'content': forms.Textarea(attrs={'rows': 6, 'class': 'form-control', 'placeholder': _('Enter material content')}),
'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': _('Enter material title')}),
# 💡 Use SummernoteWidget here
'content': SummernoteWidget(attrs={'placeholder': _('Enter material content')}),
'video_link': forms.URLInput(attrs={'class': 'form-control', 'placeholder': _('https://www.youtube.com/watch?v=...')}),
'file': forms.FileInput(attrs={'class': 'form-control'}),
}
# The __init__ and FormHelper layout remains the same
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-md-3'
self.helper.field_class = 'col-md-9'
self.helper.form_class = 'g-3'
self.helper.layout = Layout(
Field('title', css_class='form-control'),
Field('content', css_class='form-control'),
Div(
Field('video_link', css_class='form-control'),
Field('file', css_class='form-control'),
css_class='row'
'title',
'content', # Summernote is applied via the widgets dictionary
Row(
Column('video_link', css_class='col-md-6'),
Column('file', css_class='col-md-6'),
css_class='g-3 mb-4'
),
Submit('submit', _('Save Material'), css_class='btn btn-primary mt-3')
Div(
Submit('submit', _('Create Material'),
css_class='btn btn-main-action'),
css_class='col-12 mt-4'
)
)
@ -222,25 +229,22 @@ class JobPostingForm(forms.ModelForm):
'value': 'United States'
}),
# Job Details
'description': forms.Textarea(attrs={
'class': 'form-control',
'rows': 6,
# Job Details (Using SummernoteWidget)
'description': SummernoteWidget(attrs={
# Removed 'class' and 'rows' as Summernote handles styling
'placeholder': 'Provide a comprehensive description of the role, responsibilities, and expectations...',
'required': True
}),
'qualifications': forms.Textarea(attrs={
'class': 'form-control',
'rows': 4,
'qualifications': SummernoteWidget(attrs={
# Removed 'class' and 'rows'
'placeholder': 'List required qualifications, skills, education, and experience...'
}),
'salary_range': forms.TextInput(attrs={
'class': 'form-control',
'placeholder': '$60,000 - $80,000'
}),
'benefits': forms.Textarea(attrs={
'class': 'form-control',
'rows': 2,
'benefits': SummernoteWidget(attrs={
# Removed 'class' and 'rows'
'placeholder': 'Health insurance, retirement plans, tuition reimbursement, etc.'
}),
@ -254,9 +258,8 @@ class JobPostingForm(forms.ModelForm):
'class': 'form-control',
'type': 'date'
}),
'application_instructions': forms.Textarea(attrs={
'class': 'form-control',
'rows': 3,
'application_instructions': SummernoteWidget(attrs={
# Removed 'class' and 'rows'
'placeholder': 'Special instructions for applicants (e.g., required documents, reference requirements, etc.)'
}),
'open_positions': forms.NumberInput(attrs={
@ -267,8 +270,7 @@ class JobPostingForm(forms.ModelForm):
'hash_tags': forms.TextInput(attrs={
'class': 'form-control',
'placeholder': '#hiring,#jobopening',
'validators':validate_hash_tags,
# 'validators':validate_hash_tags, # Assuming this is available
}),
# Internal Information

View File

@ -279,7 +279,7 @@
</span>
</a>
</li> {% endcomment %}
<li class="nav-item">
<li class="nav-item me-2">
<a class="nav-link {% if request.resolver_match.url_name == 'job_list' %}active{% endif %}" href="{% url 'job_list' %}">
<span class="d-flex align-items-center gap-2">
{% include "icons/jobs.html" %}
@ -287,7 +287,7 @@
</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item me-2">
<a class="nav-link {% if request.resolver_match.url_name == 'candidate_list' %}active{% endif %}" href="{% url 'candidate_list' %}">
<span class="d-flex align-items-center gap-2">
{% include "icons/users.html" %}
@ -295,7 +295,7 @@
</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item me-2">
<a class="nav-link {% if request.resolver_match.url_name == 'training_list' %}active{% endif %}" href="{% url 'training_list' %}">
<span class="d-flex align-items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
@ -306,7 +306,7 @@
</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item me-2">
<a class="nav-link {% if request.resolver_match.url_name == 'list_meetings' %}active{% endif %}" href="{% url 'list_meetings' %}">
<span class="d-flex align-items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
@ -317,7 +317,7 @@
</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item me-2">
<a class="nav-link {% if request.resolver_match.url_name == 'form_templates_list' %}active{% endif %}" href="{% url 'form_templates_list' %}">
<span class="d-flex align-items-center gap-2">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@ -327,7 +327,7 @@
</span>
</a>
</li>
<li class="nav-item dropdown">
<li class="nav-item dropdown ms-2">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
data-bs-offset="0, 8" data-bs-auto-close="outside">
{% trans "More" %}
@ -378,7 +378,7 @@
</li>
</ul>
<ul class="navbar-nav">
<ul class="navbar-nav ms-4">
<li class="nav-item dropdown">
<button
class="nav-link p-0 border-0 bg-transparent dropdown-toggle"

View File

@ -4,9 +4,12 @@
{% block title %}Create New Job Post - {{ block.super }}{% endblock %}
{% block customCSS %}
{# 💡 1. Add Summernote CSS Media in the head #}
{{ form.media.css }}
<style>
/* ================================================= */
/* THEME VARIABLES AND GLOBAL STYLES */
/* THEME VARIABLES AND GLOBAL STYLES (Keep existing) */
/* ================================================= */
:root {
--kaauh-teal: #00636e;
@ -15,10 +18,7 @@
--kaauh-primary-text: #343a40;
}
/* Primary Color Overrides */
.text-primary { color: var(--kaauh-teal) !important; }
/* Main Action Button Style */
.btn-main-action, .btn-primary {
background-color: var(--kaauh-teal);
border-color: var(--kaauh-teal);
@ -36,8 +36,6 @@
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
/* Secondary/Cancel Button Style */
.btn-secondary {
background-color: #f8f9fa;
color: var(--kaauh-teal-dark);
@ -46,11 +44,9 @@
}
.btn-secondary:hover {
background-color: #e9ecef;
color: var(--kaauh-teal-dark);
border-color: #ced4da;
color: white;
border-color: var(--kaauh-teal-dark);
}
/* Card enhancements */
.card {
border: 1px solid var(--kaauh-border);
border-radius: 0.75rem;
@ -58,340 +54,293 @@
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
background-color: white;
}
/* Themed Card Header (replacing bg-light) */
.card-header-themed {
background-color: #f0f8ff; /* Very light blue background */
background-color: #f0f8ff;
border-bottom: 2px solid var(--kaauh-teal);
color: var(--kaauh-teal-dark);
font-weight: 700;
padding: 1rem 1.5rem;
}
.card-header-themed h5 {
font-weight: 700;
color: var(--kaauh-teal-dark);
margin: 0;
display: flex;
align-items: center;
gap: 0.75rem;
}
/* Form Fixes for manual rendering consistency */
.form-label {
font-weight: 600;
color: var(--kaauh-primary-text);
margin-bottom: 0.3rem;
display: block;
}
/* CRITICAL FIX: Target all relevant input types inside the form to mimic form-control class */
.card-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
.card-body textarea,
.card-body select {
/* Apply form-control styling */
border-radius: 0.5rem;
border: 1px solid #ced4da;
width: 100%;
padding: 0.375rem 0.75rem;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
/* Ensure inputs rendered without class attribute are styled */
box-sizing: border-box;
}
.card-body textarea {
min-height: 8rem;
}
/* File input styling is kept minimal as it's harder to style universally */
.card-body input[type="file"] {
padding-top: 0.5rem;
/* ================================================= */
/* ✅ CORRECTED SUMMERNOTE FULL-WIDTH STYLING */
/* ================================================= */
/* Make every Summernote editor fill its container */
.note-editor {
width: 100% !important;
box-sizing: border-box !important;
margin: 0 !important;
max-width: none !important;
border-radius: 0.5rem;
}
/* Set minimum heights for specific fields using sibling selector */
#id_description + .note-editor { min-height: 300px; }
#id_qualifications + .note-editor { min-height: 200px; }
#id_benefits + .note-editor,
#id_application_instructions + .note-editor { min-height: 150px; }
</style>
{% endblock %}
{% block content %}
<div class="container-fluid py-4">
<div class="container-fluid py-4">
<h1 class="h3 mb-4 text-primary fw-bold">
<i class="fas fa-bullhorn me-2"></i> {% trans "Create New Job Posting" %}
<i class="fas fa-bullhorn me-2"></i> {% if form.instance.pk %} {% trans "Edit Job Posting" %} {% else %} {% trans "Create New Job Posting" %} {% endif %}
</h1>
<form method="post" id="jobForm" class="mb-5">
<form method="post" id="jobForm" class="mb-5" enctype="multipart/form-data">
{% csrf_token %}
{# ================================================= #}
{# SECTION 1: CORE POSITION DETAILS #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-info-circle"></i> {% trans "Basic Information" %}</h5>
<h5><i class="fas fa-info-circle"></i> {% trans "Core Position Details" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-8">
<div>
<label for="{{ form.title.id_for_label }}" class="form-label">{% trans "Job Title" %} <span class="text-danger">*</span></label>
{# Removed |attr:"class:form-control" #}
{{ form.title }}
{% if form.title.errors %}
<div class="text-danger small mt-1">{{ form.title.errors }}</div>
{% endif %}
{% if form.title.errors %}<div class="text-danger small mt-1">{{ form.title.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.job_type.id_for_label }}" class="form-label">{% trans "Job Type" %} <span class="text-danger">*</span></label>
{# Removed |attr:"class:form-control" #}
{{ form.job_type }}
{% if form.job_type.errors %}
<div class="text-danger small mt-1">{{ form.job_type.errors }}</div>
{% endif %}
{% if form.job_type.errors %}<div class="text-danger small mt-1">{{ form.job_type.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.department.id_for_label }}" class="form-label">{% trans "Department" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.department }}
{% if form.department.errors %}
<div class="text-danger small mt-1">{{ form.department.errors }}</div>
{% endif %}
{% if form.department.errors %}<div class="text-danger small mt-1">{{ form.department.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.position_number.id_for_label }}" class="form-label">{% trans "Position Number" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.position_number }}
{% if form.position_number.errors %}
<div class="text-danger small mt-1">{{ form.position_number.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.workplace_type.id_for_label }}" class="form-label">{% trans "Workplace Type" %} <span class="text-danger">*</span></label>
{# Removed |attr:"class:form-control" #}
{{ form.workplace_type }}
{% if form.workplace_type.errors %}
<div class="text-danger small mt-1">{{ form.workplace_type.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.created_by.id_for_label }}" class="form-label">{% trans "Created By" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.created_by }}
{% if form.created_by.errors %}
<div class="text-danger small mt-1">{{ form.created_by.errors }}</div>
{% endif %}
{% if form.workplace_type.errors %}<div class="text-danger small mt-1">{{ form.workplace_type.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 2: JOB CONTENT (All Summernote Fields) #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-map-marker-alt"></i> {% trans "Location" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-4">
<div>
<label for="{{ form.location_city.id_for_label }}" class="form-label">{% trans "City" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.location_city }}
{% if form.location_city.errors %}
<div class="text-danger small mt-1">{{ form.location_city.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.location_state.id_for_label }}" class="form-label">{% trans "State/Province" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.location_state }}
{% if form.location_state.errors %}
<div class="text-danger small mt-1">{{ form.location_state.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.location_country.id_for_label }}" class="form-label">{% trans "Country" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.location_country }}
{% if form.location_country.errors %}
<div class="text-danger small mt-1">{{ form.location_country.errors }}</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-file-alt"></i> {% trans "Job Details" %}</h5>
<h5><i class="fas fa-file-alt"></i> {% trans "Job Content" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-12">
<div>
<label for="{{ form.description.id_for_label }}" class="form-label">{% trans "Job Description" %} <span class="text-danger">*</span></label>
{# Removed |attr:"class:form-control" #}
{{ form.description }}
{% if form.description.errors %}
<div class="text-danger small mt-1">{{ form.description.errors }}</div>
{% endif %}
{% if form.description.errors %}<div class="text-danger small mt-1">{{ form.description.errors }}</div>{% endif %}
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.qualifications.id_for_label }}" class="form-label">{% trans "Qualifications and Requirements" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.qualifications }}
{% if form.qualifications.errors %}
<div class="text-danger small mt-1">{{ form.qualifications.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.salary_range.id_for_label }}" class="form-label">{% trans "Salary Range" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.salary_range }}
{% if form.salary_range.errors %}
<div class="text-danger small mt-1">{{ form.salary_range.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.benefits.id_for_label }}" class="form-label">{% trans "Benefits" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.benefits }}
{% if form.benefits.errors %}
<div class="text-danger small mt-1">{{ form.benefits.errors }}</div>
{% endif %}
{% if form.qualifications.errors %}<div class="text-danger small mt-1">{{ form.qualifications.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 3: COMPENSATION AND APPLICATION #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-file-signature"></i> {% trans "Application Information" %}</h5>
<h5><i class="fas fa-dollar-sign"></i> {% trans "Compensation & Application" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-12">
<div class="col-md-6">
<div>
<label for="{{ form.salary_range.id_for_label }}" class="form-label">{% trans "Salary Range" %}</label>
{{ form.salary_range }}
{% if form.salary_range.errors %}<div class="text-danger small mt-1">{{ form.salary_range.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.application_url.id_for_label }}" class="form-label">{% trans "Application URL" %} <span class="text-danger">*</span></label>
{# Removed |attr:"class:form-control" #}
{{ form.application_url }}
{% if form.application_url.errors %}
<div class="text-danger small mt-1">{{ form.application_url.errors }}</div>
{% endif %}
{% if form.application_url.errors %}<div class="text-danger small mt-1">{{ form.application_url.errors }}</div>{% endif %}
<div class="form-text">{% trans "Full URL where candidates will apply" %}</div>
</div>
</div>
<div class="col-md-6">
<div class="col-12">
<div>
<label for="{{ form.application_deadline.id_for_label }}" class="form-label">{% trans "Application Deadline" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.application_deadline }}
{% if form.application_deadline.errors %}
<div class="text-danger small mt-1">{{ form.application_deadline.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.start_date.id_for_label }}" class="form-label">{% trans "Desired Start Date" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.start_date }}
{% if form.start_date.errors %}
<div class="text-danger small mt-1">{{ form.start_date.errors }}</div>
{% endif %}
<label for="{{ form.benefits.id_for_label }}" class="form-label">{% trans "Benefits" %}</label>
{{ form.benefits }}
{% if form.benefits.errors %}<div class="text-danger small mt-1">{{ form.benefits.errors }}</div>{% endif %}
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.application_instructions.id_for_label }}" class="form-label">{% trans "Application Instructions" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.application_instructions }}
{% if form.application_instructions.errors %}
<div class="text-danger small mt-1">{{ form.application_instructions.errors }}</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-star"></i>{% trans "Post Reach Field" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-12">
<div>
<label for="{{ form.hash_tags.id_for_label }}" class="form-label">{% trans "Hashtags" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.hash_tags }}
{% if form.hash_tags.errors %}
<div class="text-danger small mt-1">{{ form.hash_tags.errors }}</div>
{% endif %}
{% if form.application_instructions.errors %}<div class="text-danger small mt-1">{{ form.application_instructions.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 4: LOCATION AND DATES #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-building"></i> {% trans "Internal Information" %}</h5>
<h5><i class="fas fa-map-marker-alt"></i> {% trans "Location, Dates, & Status" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-4">
<div>
<label for="{{ form.location_city.id_for_label }}" class="form-label">{% trans "City" %}</label>
{{ form.location_city }}
{% if form.location_city.errors %}<div class="text-danger small mt-1">{{ form.location_city.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.location_state.id_for_label }}" class="form-label">{% trans "State/Province" %}</label>
{{ form.location_state }}
{% if form.location_state.errors %}<div class="text-danger small mt-1">{{ form.location_state.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.location_country.id_for_label }}" class="form-label">{% trans "Country" %}</label>
{{ form.location_country }}
{% if form.location_country.errors %}<div class="text-danger small mt-1">{{ form.location_country.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.application_deadline.id_for_label }}" class="form-label">{% trans "Application Deadline" %}</label>
{{ form.application_deadline }}
{% if form.application_deadline.errors %}<div class="text-danger small mt-1">{{ form.application_deadline.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.start_date.id_for_label }}" class="form-label">{% trans "Desired Start Date" %}</label>
{{ form.start_date }}
{% if form.start_date.errors %}<div class="text-danger small mt-1">{{ form.start_date.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.status.id_for_label }}" class="form-label">{% trans "Status" %}</label>
{{ form.status }}
{% if form.status.errors %}<div class="text-danger small mt-1">{{ form.status.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 5: INTERNAL AND PROMOTION #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-tags"></i> {% trans "Internal & Promotion" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-6">
<div>
<label for="{{ form.position_number.id_for_label }}" class="form-label">{% trans "Position Number" %}</label>
{{ form.position_number }}
{% if form.position_number.errors %}<div class="text-danger small mt-1">{{ form.position_number.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.reporting_to.id_for_label }}" class="form-label">{% trans "Reports To" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.reporting_to }}
{% if form.reporting_to.errors %}
<div class="text-danger small mt-1">{{ form.reporting_to.errors }}</div>
{% endif %}
{% if form.reporting_to.errors %}<div class="text-danger small mt-1">{{ form.reporting_to.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.open_positions.id_for_label }}" class="form-label">{% trans "Open Positions" %}</label>
{# Removed |attr:"class:form-control" #}
{{ form.open_positions }}
{% if form.open_positions.errors %}
<div class="text-danger small mt-1">{{ form.open_positions.errors }}</div>
{% endif %}
{% if form.open_positions.errors %}<div class="text-danger small mt-1">{{ form.open_positions.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.created_by.id_for_label }}" class="form-label">{% trans "Created By" %}</label>
{{ form.created_by }}
{% if form.created_by.errors %}<div class="text-danger small mt-1">{{ form.created_by.errors }}</div>{% endif %}
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.hash_tags.id_for_label }}" class="form-label">{% trans "Hashtags (For Promotion/Search)" %}</label>
{{ form.hash_tags }}
{% if form.hash_tags.errors %}<div class="text-danger small mt-1">{{ form.hash_tags.errors }}</div>{% endif %}
<div class="form-text">{% trans "Comma-separated list of hashtags, e.g., #hiring, #professor" %}</div>
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# ACTION BUTTONS #}
{# ================================================= #}
<div class="d-flex justify-content-between pt-2">
<a href="{% url 'job_list' %}" class="btn btn-secondary">
<i class="fas fa-arrow-left me-1"></i> {% trans "Cancel" %}
</a>
<button type="submit" class="btn btn-main-action">
<i class="fas fa-save me-1"></i> {% trans "Create Job" %}
<i class="fas fa-save me-1"></i> {% trans "Save Job" %}
</button>
</div>
</form>
</div>
{# 💡 2. Add Summernote JS Media at the end of the body #}
{{ form.media.js }}
{% endblock %}

View File

@ -1,259 +1,354 @@
{% extends "base.html" %}
{% load static i18n %}
{% block title %}Edit {{ job.title }} - University ATS{% endblock %}
{% block customCSS %}
{# 💡 1. Add Summernote CSS Media in the head #}
{{ form.media.css }}
<style>
/* ================================================= */
/* THEME VARIABLES AND GLOBAL STYLES (Keep existing) */
/* ================================================= */
:root {
--kaauh-teal: #00636e;
--kaauh-teal-dark: #004a53;
--kaauh-border: #eaeff3;
--kaauh-primary-text: #343a40;
}
.text-primary { color: var(--kaauh-teal) !important; }
.btn-main-action, .btn-primary {
background-color: var(--kaauh-teal);
border-color: var(--kaauh-teal);
color: white;
font-weight: 600;
padding: 0.6rem 1.2rem;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn-main-action:hover, .btn-primary:hover {
background-color: var(--kaauh-teal-dark);
border-color: var(--kaauh-teal-dark);
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.btn-secondary {
background-color: #f8f9fa;
color: var(--kaauh-teal-dark);
border: 1px solid var(--kaauh-border);
font-weight: 500;
}
.btn-secondary:hover {
background-color: #e9ecef;
color: var(--kaauh-teal-dark); /* Reverting color to dark theme text */
border-color: var(--kaauh-teal-dark);
}
.card {
border: 1px solid var(--kaauh-border);
border-radius: 0.75rem;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
background-color: white;
}
.card-header-themed {
background-color: #f0f8ff;
border-bottom: 2px solid var(--kaauh-teal);
color: var(--kaauh-teal-dark);
font-weight: 700;
padding: 1rem 1.5rem;
}
.form-label {
font-weight: 600;
color: var(--kaauh-primary-text);
margin-bottom: 0.3rem;
display: block;
}
.card-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
.card-body select {
border-radius: 0.5rem;
border: 1px solid #ced4da;
width: 100%;
padding: 0.375rem 0.75rem;
box-sizing: border-box;
}
/* ================================================= */
/* ✅ CORRECTED SUMMERNOTE FULL-WIDTH STYLING (Active Fix) */
/* ================================================= */
/* The most aggressive, universal fix for Summernote within Bootstrap columns */
.col-12 .note-editor {
/* This compensates for the 0.75rem padding on each side of the col-12 */
width: calc(100% + 1.5rem) !important;
margin-left: -0.75rem !important;
margin-right: -0.75rem !important;
/* General cleanup to maintain look */
box-sizing: border-box;
margin-bottom: 0 !important;
border-radius: 0.5rem;
}
/* Set minimum heights for specific fields using sibling selector */
#id_description + .note-editor { min-height: 300px; }
#id_qualifications + .note-editor { min-height: 200px; }
#id_benefits + .note-editor,
#id_application_instructions + .note-editor { min-height: 150px; }
</style>
{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="card">
<div class="card-header">
<h2><i class="fas fa-edit"></i> Edit Job Posting</h2>
<small class="text-muted">Internal ID: {{ job.internal_job_id }}</small>
<div class="container-fluid py-4">
<h1 class="h3 mb-4 text-primary fw-bold">
{# UPDATED TITLE FOR EDIT CONTEXT #}
<i class="fas fa-edit me-2"></i> {% trans "Edit Job Posting" %}
{% if job.title %} - {{ job.title }} {% endif %}
</h1>
<form method="post" id="jobForm" class="mb-5" enctype="multipart/form-data">
{% csrf_token %}
{# ================================================= #}
{# SECTION 1: CORE POSITION DETAILS #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-info-circle"></i> {% trans "Core Position Details" %}</h5>
</div>
<div class="card-body">
<form method="post" id="jobForm">
{% csrf_token %}
<!-- Basic Information Section -->
<div class="card mb-4">
<div class="card-header bg-light">
<h5 class="mb-0"><i class="fas fa-info-circle"></i> Basic Information</h5>
<div class="row g-4">
<div class="col-md-8">
<div>
<label for="{{ form.title.id_for_label }}" class="form-label">{% trans "Job Title" %} <span class="text-danger">*</span></label>
{{ form.title }}
{% if form.title.errors %}<div class="text-danger small mt-1">{{ form.title.errors }}</div>{% endif %}
</div>
<div class="card-body">
<div class="row">
<div class="col-md-8">
<div class="mb-3">
<label for="{{ form.title.id_for_label }}" class="form-label">Job Title <span class="text-danger">*</span></label>
{{ form.title }}
{% if form.title.errors %}
<div class="text-danger mt-1">{{ form.title.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-4">
<div class="mb-3">
<label for="{{ form.job_type.id_for_label }}" class="form-label">Job Type <span class="text-danger">*</span></label>
{{ form.job_type }}
{% if form.job_type.errors %}
<div class="text-danger mt-1">{{ form.job_type.errors }}</div>
{% endif %}
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.department.id_for_label }}" class="form-label">Department</label>
{{ form.department }}
{% if form.department.errors %}
<div class="text-danger mt-1">{{ form.department.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.position_number.id_for_label }}" class="form-label">Position Number</label>
{{ form.position_number }}
{% if form.position_number.errors %}
<div class="text-danger mt-1">{{ form.position_number.errors }}</div>
{% endif %}
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.workplace_type.id_for_label }}" class="form-label">Workplace Type <span class="text-danger">*</span></label>
{{ form.workplace_type }}
{% if form.workplace_type.errors %}
<div class="text-danger mt-1">{{ form.workplace_type.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.created_by.id_for_label }}" class="form-label">Created By</label>
{{ form.created_by }}
{% if form.created_by.errors %}
<div class="text-danger mt-1">{{ form.created_by.errors }}</div>
{% endif %}
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.job_type.id_for_label }}" class="form-label">{% trans "Job Type" %} <span class="text-danger">*</span></label>
{{ form.job_type }}
{% if form.job_type.errors %}<div class="text-danger small mt-1">{{ form.job_type.errors }}</div>{% endif %}
</div>
</div>
<!-- Location Section -->
<div class="card mb-4">
<div class="card-header bg-light">
<h5 class="mb-0"><i class="fas fa-map-marker-alt"></i> Location</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-4">
<div class="mb-3">
<label for="{{ form.location_city.id_for_label }}" class="form-label">City</label>
{{ form.location_city }}
{% if form.location_city.errors %}
<div class="text-danger mt-1">{{ form.location_city.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-4">
<div class="mb-3">
<label for="{{ form.location_state.id_for_label }}" class="form-label">State/Province</label>
{{ form.location_state }}
{% if form.location_state.errors %}
<div class="text-danger mt-1">{{ form.location_state.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-4">
<div class="mb-3">
<label for="{{ form.location_country.id_for_label }}" class="form-label">Country</label>
{{ form.location_country }}
{% if form.location_country.errors %}
<div class="text-danger mt-1">{{ form.location_country.errors }}</div>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.department.id_for_label }}" class="form-label">{% trans "Department" %}</label>
{{ form.department }}
{% if form.department.errors %}<div class="text-danger small mt-1">{{ form.department.errors }}</div>{% endif %}
</div>
</div>
<!-- Job Details Section -->
<div class="card mb-4">
<div class="card-header bg-light">
<h5 class="mb-0"><i class="fas fa-file-alt"></i> Job Details</h5>
</div>
<div class="card-body">
<div class="mb-3">
<label for="{{ form.description.id_for_label }}" class="form-label">Job Description <span class="text-danger">*</span></label>
{{ form.description }}
{% if form.description.errors %}
<div class="text-danger mt-1">{{ form.description.errors }}</div>
{% endif %}
</div>
<div class="mb-3">
<label for="{{ form.qualifications.id_for_label }}" class="form-label">Qualifications and Requirements</label>
{{ form.qualifications }}
{% if form.qualifications.errors %}
<div class="text-danger mt-1">{{ form.qualifications.errors }}</div>
{% endif %}
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.salary_range.id_for_label }}" class="form-label">Salary Range</label>
{{ form.salary_range }}
{% if form.salary_range.errors %}
<div class="text-danger mt-1">{{ form.salary_range.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.benefits.id_for_label }}" class="form-label">Benefits</label>
{{ form.benefits }}
{% if form.benefits.errors %}
<div class="text-danger mt-1">{{ form.benefits.errors }}</div>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.workplace_type.id_for_label }}" class="form-label">{% trans "Workplace Type" %} <span class="text-danger">*</span></label>
{{ form.workplace_type }}
{% if form.workplace_type.errors %}<div class="text-danger small mt-1">{{ form.workplace_type.errors }}</div>{% endif %}
</div>
</div>
<!-- Application Information Section -->
<div class="card mb-4">
<div class="card-header bg-light">
<h5 class="mb-0"><i class="fas fa-file-signature"></i> Application Information</h5>
</div>
<div class="card-body">
<div class="mb-3">
<label for="{{ form.application_url.id_for_label }}" class="form-label">Application URL <span class="text-danger">*</span></label>
{{ form.application_url }}
{% if form.application_url.errors %}
<div class="text-danger mt-1">{{ form.application_url.errors }}</div>
{% endif %}
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.application_deadline.id_for_label }}" class="form-label">Application Deadline</label>
{{ form.application_deadline }}
{% if form.application_deadline.errors %}
<div class="text-danger mt-1">{{ form.application_deadline.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.start_date.id_for_label }}" class="form-label">Desired Start Date</label>
{{ form.start_date }}
{% if form.start_date.errors %}
<div class="text-danger mt-1">{{ form.start_date.errors }}</div>
{% endif %}
</div>
</div>
</div>
<div class="mb-3">
<label for="{{ form.application_instructions.id_for_label }}" class="form-label">Application Instructions</label>
{{ form.application_instructions }}
{% if form.application_instructions.errors %}
<div class="text-danger mt-1">{{ form.application_instructions.errors }}</div>
{% endif %}
</div>
</div>
</div>
<!-- Internal Information Section -->
<div class="card mb-4">
<div class="card-header bg-light">
<h5 class="mb-0"><i class="fas fa-building"></i> Internal Information</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.reporting_to.id_for_label }}" class="form-label">Reports To</label>
{{ form.reporting_to }}
{% if form.reporting_to.errors %}
<div class="text-danger mt-1">{{ form.reporting_to.errors }}</div>
{% endif %}
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="{{ form.open_positions.id_for_label }}" class="form-label">Open positions</label>
{{ form.open_positions }}
{% if form.open_positions.errors %}
<div class="text-danger mt-1">{{ form.open_positions.errors }}</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="d-flex justify-content-between">
<a href="{% url 'job_detail' job.slug %}" class="btn btn-secondary">
<i class="fas fa-arrow-left"></i> Cancel
</a>
<button type="submit" class="btn btn-primary">
<i class="fas fa-save"></i> Update Job
</button>
</div>
</form>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 2: JOB CONTENT (All Summernote Fields) #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-file-alt"></i> {% trans "Job Content" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-12">
<div>
<label for="{{ form.description.id_for_label }}" class="form-label">{% trans "Job Description" %} <span class="text-danger">*</span></label>
{{ form.description }}
{% if form.description.errors %}<div class="text-danger small mt-1">{{ form.description.errors }}</div>{% endif %}
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.qualifications.id_for_label }}" class="form-label">{% trans "Qualifications and Requirements" %}</label>
{{ form.qualifications }}
{% if form.qualifications.errors %}<div class="text-danger small mt-1">{{ form.qualifications.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 3: COMPENSATION AND APPLICATION #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-dollar-sign"></i> {% trans "Compensation & Application" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-6">
<div>
<label for="{{ form.salary_range.id_for_label }}" class="form-label">{% trans "Salary Range" %}</label>
{{ form.salary_range }}
{% if form.salary_range.errors %}<div class="text-danger small mt-1">{{ form.salary_range.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.application_url.id_for_label }}" class="form-label">{% trans "Application URL" %} <span class="text-danger">*</span></label>
{{ form.application_url }}
{% if form.application_url.errors %}<div class="text-danger small mt-1">{{ form.application_url.errors }}</div>{% endif %}
<div class="form-text">{% trans "Full URL where candidates will apply" %}</div>
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.benefits.id_for_label }}" class="form-label">{% trans "Benefits" %}</label>
{{ form.benefits }}
{% if form.benefits.errors %}<div class="text-danger small mt-1">{{ form.benefits.errors }}</div>{% endif %}
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.application_instructions.id_for_label }}" class="form-label">{% trans "Application Instructions" %}</label>
{{ form.application_instructions }}
{% if form.application_instructions.errors %}<div class="text-danger small mt-1">{{ form.application_instructions.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 4: LOCATION AND DATES #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-map-marker-alt"></i> {% trans "Location, Dates, & Status" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-4">
<div>
<label for="{{ form.location_city.id_for_label }}" class="form-label">{% trans "City" %}</label>
{{ form.location_city }}
{% if form.location_city.errors %}<div class="text-danger small mt-1">{{ form.location_city.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.location_state.id_for_label }}" class="form-label">{% trans "State/Province" %}</label>
{{ form.location_state }}
{% if form.location_state.errors %}<div class="text-danger small mt-1">{{ form.location_state.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.location_country.id_for_label }}" class="form-label">{% trans "Country" %}</label>
{{ form.location_country }}
{% if form.location_country.errors %}<div class="text-danger small mt-1">{{ form.location_country.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.application_deadline.id_for_label }}" class="form-label">{% trans "Application Deadline" %}</label>
{{ form.application_deadline }}
{% if form.application_deadline.errors %}<div class="text-danger small mt-1">{{ form.application_deadline.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.start_date.id_for_label }}" class="form-label">{% trans "Desired Start Date" %}</label>
{{ form.start_date }}
{% if form.start_date.errors %}<div class="text-danger small mt-1">{{ form.start_date.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-4">
<div>
<label for="{{ form.status.id_for_label }}" class="form-label">{% trans "Status" %}</label>
{{ form.status }}
{% if form.status.errors %}<div class="text-danger small mt-1">{{ form.status.errors }}</div>{% endif %}
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# SECTION 5: INTERNAL AND PROMOTION #}
{# ================================================= #}
<div class="card mb-4 shadow-sm">
<div class="card-header-themed">
<h5><i class="fas fa-tags"></i> {% trans "Internal & Promotion" %}</h5>
</div>
<div class="card-body">
<div class="row g-4">
<div class="col-md-6">
<div>
<label for="{{ form.position_number.id_for_label }}" class="form-label">{% trans "Position Number" %}</label>
{{ form.position_number }}
{% if form.position_number.errors %}<div class="text-danger small mt-1">{{ form.position_number.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.reporting_to.id_for_label }}" class="form-label">{% trans "Reports To" %}</label>
{{ form.reporting_to }}
{% if form.reporting_to.errors %}<div class="text-danger small mt-1">{{ form.reporting_to.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.open_positions.id_for_label }}" class="form-label">{% trans "Open Positions" %}</label>
{{ form.open_positions }}
{% if form.open_positions.errors %}<div class="text-danger small mt-1">{{ form.open_positions.errors }}</div>{% endif %}
</div>
</div>
<div class="col-md-6">
<div>
<label for="{{ form.created_by.id_for_label }}" class="form-label">{% trans "Created By" %}</label>
{{ form.created_by }}
{% if form.created_by.errors %}<div class="text-danger small mt-1">{{ form.created_by.errors }}</div>{% endif %}
</div>
</div>
<div class="col-12">
<div>
<label for="{{ form.hash_tags.id_for_label }}" class="form-label">{% trans "Hashtags (For Promotion/Search)" %}</label>
{{ form.hash_tags }}
{% if form.hash_tags.errors %}<div class="text-danger small mt-1">{{ form.hash_tags.errors }}</div>{% endif %}
<div class="form-text">{% trans "Comma-separated list of hashtags, e.g., #hiring, #professor" %}</div>
</div>
</div>
</div>
</div>
</div>
{# ================================================= #}
{# ACTION BUTTONS #}
{# ================================================= #}
<div class="d-flex justify-content-between pt-2">
{# UPDATED CANCEL URL for Job Detail #}
<a href="{% url 'job_detail' job.slug %}" class="btn btn-secondary">
<i class="fas fa-arrow-left me-1"></i> {% trans "Cancel" %}
</a>
<button type="submit" class="btn btn-main-action">
{# UPDATED BUTTON TEXT for Edit action #}
<i class="fas fa-save me-1"></i> {% trans "Update Job" %}
</button>
</div>
</form>
</div>
{% endblock %}
{# 💡 2. Add Summernote JS Media at the end of the body #}
{{ form.media.js }}
{% endblock %}

View File

@ -4,9 +4,12 @@
{% block title %}Create Training Material - {{ block.super }}{% endblock %}
{% block customCSS %}
{# 💡 Required for Summernote if you added it, otherwise remove this line #}
{{ form.media.css }}
<style>
/* ================================================= */
/* THEME VARIABLES AND GLOBAL STYLES */
/* (Your existing CSS is kept here) */
/* ================================================= */
:root {
--kaauh-teal: #00636e;
@ -81,29 +84,13 @@
}
/* ================================================= */
/* FIX: CRISPY FORMS ALIGNMENT/SPACING */
/* CLEANUP: CRISPY FORMS STYLES (Kept to ensure good defaults) */
/* ================================================= */
/* Crispy forms wraps each field in a div with .mb-3.
This rule ensures the label and input are vertically aligned
and have clean spacing when inside a grid column. */
.card-body .form-group .form-label,
.card-body .form-group .input-group-text {
/* Align text within label if necessary (usually unnecessary) */
vertical-align: middle;
.card-body .form-group .form-label {
font-weight: 600;
color: var(--kaauh-primary-text);
margin-bottom: 0.5rem;
}
/* Ensures the form elements themselves are cleanly aligned */
.card-body .form-group {
/* Ensures consistent bottom spacing for all form groups */
margin-bottom: 1.2rem;
}
/* Override for fields inside the grid, using Bootstrap 5's default
g-x for horizontal and g-y for vertical padding from the row */
.card-body .row .col-md-6 .form-group {
margin-bottom: 0 !important; /* Let the row's g-4 handle vertical spacing */
}
</style>
{% endblock %}
@ -138,27 +125,19 @@
</h2>
</div>
<div class="card-body">
<form method="post" enctype="multipart/form-data">
<form method="post" enctype="multipart/form-data" class="row">
{% csrf_token %}
{# Use a row structure with g-3 for slightly tighter spacing #}
<div class="row g-3">
{# Iterate through all form fields #}
{% for field in form %}
<div class="col-md-{% if field.field.widget.input_type == 'textarea' or field.field.widget.input_type == 'file' %}12{% else %}6{% endif %}">
{# Crispy field rendering #}
{{ field|as_crispy_field }}
</div>
{% endfor %}
</div>
{% crispy form %}
<hr class="mt-4 mb-4">
<button class="btn btn-main-action" type="submit">
<i class="fas fa-save me-1"></i>
{% trans "Create Material" %}
</button>
</form>
</div>
</div>
</div>
{# 💡 Required for Summernote if you added it, otherwise remove this line #}
{{ form.media.js }}
{% endblock %}