This commit is contained in:
Faheed 2025-11-03 12:20:14 +03:00
parent 7e5dfad1dd
commit 406ba3b3b6
11 changed files with 17 additions and 12 deletions

View File

@ -66,7 +66,7 @@ INSTALLED_APPS = [
SITE_ID = 1
LOGIN_REDIRECT_URL = '/'
LOGIN_REDIRECT_URL = 'dashboard'
ACCOUNT_LOGOUT_REDIRECT_URL = '/'
@ -183,7 +183,6 @@ ACCOUNT_LOGIN_METHODS = ['email']
ACCOUNT_SIGNUP_FIELDS = ['email*', 'password1*', 'password2*']
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
@ -196,7 +195,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Crispy Forms Configuration
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrapconsole5"
# Bootstrap 5 Configuration
CRISPY_BS5 = {

View File

@ -702,14 +702,11 @@ class Candidate(Base):
@property
def time_to_hire_days(self):
if self.hired_date:
time_to_hire_in_days=timedelta(self.hired_date-self.created_at.date())
print(self.created_at.date)
return time_to_hire_in_days
if self.hired_date and self.created_at:
time_to_hire = self.hired_date - self.created_at.date()
return time_to_hire.days
return 0
class TrainingMaterial(Base):
title = models.CharField(max_length=255, verbose_name=_("Title"))
content = CKEditor5Field(blank=True, verbose_name=_("Content"),config_name='extends')

View File

@ -5,7 +5,7 @@ from . import views_integration
from . import views_source
urlpatterns = [
path('', views_frontend.dashboard_view, name='dashboard'),
path('dashboard/', views_frontend.dashboard_view, name='dashboard'),
# Job URLs (using JobPosting model)
path('jobs/', views_frontend.JobListView.as_view(), name='job_list'),

View File

@ -466,7 +466,7 @@ def dashboard_view(request):
print(lst)
time_to_hire_query = hired_candidates.annotate(
time_diff=ExpressionWrapper(
F('join_date') - F('created_at__date'),
F('hired_date') - F('created_at__date'),
output_field=fields.DurationField()
)
).aggregate(avg_time_to_hire=Avg('time_diff'))

View File

@ -665,7 +665,16 @@
</div>
<div class="card shadow-sm mb-4 p-2">
<h5 class="text-muted mb-3"><i class="fas fa-clock me-2"></i>{% trans "Time to Hire: " %}{{candidate.time_to_hire|default:100}}&nbsp;days</h5>
<h5 class="text-muted mb-3"><i class="fas fa-clock me-2"></i>{% trans "Time to Hire:" %}
{% with days=candidate.time_to_hire_days %}
{% if days > 0 %}
{{ days }} day{{ days|pluralize }}
{% else %}
N/A
{% endif %}
{% endwith %}
</h5>
</div>