user registeration done

This commit is contained in:
Faheed 2025-10-26 23:19:31 +03:00
parent c959c8a944
commit 9eb2b90da6
8 changed files with 84 additions and 29 deletions

View File

@ -321,23 +321,23 @@ class JobPosting(Base):
def all_candidates_count(self):
return self.candidates.annotate(
sortable_score=Cast('ai_analysis_data__match_score', output_field=CharField())).order_by(
'-sortable_score').count()
'-sortable_score').count() or 0
@property
def screening_candidates_count(self):
return self.all_candidates.filter(stage="Applied").count()
return self.all_candidates.filter(stage="Applied").count() or 0
@property
def exam_candidates_count(self):
return self.all_candidates.filter(stage="Exam").count()
return self.all_candidates.filter(stage="Exam").count() or 0
@property
def interview_candidates_count(self):
return self.all_candidates.filter(stage="Interview").count()
return self.all_candidates.filter(stage="Interview").count() or 0
@property
def offer_candidates_count(self):
return self.all_candidates.filter(stage="Offer").count()
return self.all_candidates.filter(stage="Offer").count() or 0
@property
def vacancy_fill_rate(self):

View File

@ -339,6 +339,8 @@ class TrainingDeleteView(LoginRequiredMixin, SuccessMessageMixin, DeleteView):
@login_required
def dashboard_view(request):
all_candidates_count=0
# --- Performance Optimization: Aggregate Data in ONE Query ---
# 1. Base Job Query: Get all jobs and annotate with candidate count
@ -393,27 +395,33 @@ def dashboard_view(request):
sortable_score__gte=75
).count()
high_potential_ratio = round((high_potential_count / total_candidates) * 100, 1) if total_candidates > 0 else 0
jobs=models.JobPosting.objects.all().order_by('internal_job_id')
selected_job_pk=request.GET.get('selected_job_pk','')
candidate_stage=['APPLIED','EXAM','INTERVIEW','OFFER']
apply_count,exam_count,interview_count,offer_count=[0]*4
if selected_job_pk:
job=jobs.get(pk=selected_job_pk)
apply_count=job.screening_candidates_count
exam_count=job.exam_candidates_count
interview_count=job.interview_candidates_count
offer_count=job.offer_candidates_count
all_candidates_count=job.all_candidates_count
try:
job=jobs.get(pk=selected_job_pk)
apply_count=job.screening_candidates_count
exam_count=job.exam_candidates_count
interview_count=job.interview_candidates_count
offer_count=job.offer_candidates_count
all_candidates_count=job.all_candidates_count
except Exception as e:
print(e)
else: #default job
job=jobs.first()
apply_count=job.screening_candidates_count
exam_count=job.exam_candidates_count
interview_count=job.interview_candidates_count
offer_count=job.offer_candidates_count
all_candidates_count=job.all_candidates_count
try:
job=jobs.first()
apply_count=job.screening_candidates_count
exam_count=job.exam_candidates_count
interview_count=job.interview_candidates_count
offer_count=job.offer_candidates_count
all_candidates_count=job.all_candidates_count
except Exception as e:
print(e)
candidates_count=[ apply_count,exam_count,interview_count,offer_count ]
context = {

View File

@ -0,0 +1,18 @@
{% load account i18n %}
{% autoescape off %}
{% blocktrans %}Hello,{% endblocktrans %}
{% blocktrans %}To verify the ownership of your email address, please click the confirmation link below:{% endblocktrans %}
{% trans "Confirm My KAAUH ATS Email" %}
{{ activate_url }}
{% blocktrans %}If you did not request this verification, you can safely ignore this email.{% endblocktrans %}
{% blocktrans %}Alternatively, copy and paste this link into your browser:{% endblocktrans %}
{{ activate_url }}
{% endautoescape %}

View File

@ -0,0 +1,27 @@
{% load i18n %}
{% load static %}
{% autoescape off %}
{% trans "Password Reset Request" %}
{% trans "Hello," %}
{% blocktrans %}You are receiving this email because you or someone else has requested a password reset for your account at{% endblocktrans %} {{ current_site.name }}.
------------------------------------------------------
{% trans "Click Here to Reset Your Password" %}
{{ password_reset_url }}
------------------------------------------------------
{% trans "This link is only valid for a limited time." %}
{% trans "If you did not request a password reset, please ignore this email. Your password will remain unchanged." %}
{% trans "Thank you," %}
{% trans "KAAUH ATS Team" %}
---
{% trans "If the button above does not work, copy and paste the following link into your browser:" %}
{{ password_reset_url }}
{% endautoescape %}

View File

@ -1,6 +1,8 @@
{% load static %}
{% load static i18n %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="en">
<html lang="{{LANGUAGE_CODE}}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -146,34 +148,34 @@
<div class="right-panel-content-wrapper">
<h2 id="form-title" class="h3 fw-bold mb-4 text-center">Sign In</h2>
<h2 id="form-title" class="h3 fw-bold mb-4 text-center">{% trans "Sign In" %}</h2>
<div class="form-fields">
<form id="login-form" class="space-y-4" method="post" action="{% url 'account_login' %}">
{% csrf_token %}
<div class="mb-3">
<label for="id_login" class="form-label fw-semibold">Username or Email *</label>
<input type="text" name="login" id="id_login" class="form-control" placeholder="Enter username or email" required autofocus>
<label for="id_login" class="form-label fw-semibold"> {% trans "Email *" %}</label>
<input type="text" name="login" id="id_login" class="form-control" placeholder="{% trans 'Enter your email' %}" required autofocus>
</div>
<div class="mb-3">
<label for="id_password" class="form-label fw-semibold">Password *</label>
<input type="password" name="password" id="id_password" class="form-control" placeholder="Password" required>
<label for="id_password" class="form-label fw-semibold">{% trans "Password *" %}</label>
<input type="password" name="password" id="id_password" class="form-control" placeholder="{% trans 'Password' %}" required>
<div class="text-end mt-2">
<a href="{% url 'account_reset_password' %}" class="small text-accent fw-medium">Forgot Password?</a>
<a href="{% url 'account_reset_password' %}" class="small text-accent fw-medium">{% trans 'Forgot Password?' %}</a>
</div>
</div>
<div class="form-check pt-3">
<input class="form-check-input" type="checkbox" name="remember" id="id_remember">
<label class="form-check-label text-muted" for="id_remember">
Keep me signed in
{% trans "Keep me signed in" %}
</label>
</div>
<button type="submit" class="btn btn-primary w-100 mt-4">Sign In</button>
<button type="submit" class="btn btn-primary w-100 mt-4">{% trans "Sign In" %}</button>
</form>
</div>
</div>

View File

@ -167,7 +167,7 @@
<h3><i class="fas fa-trophy stat-icon"></i> {% trans "High Potential" %}</h3>
</div>
<div class="stat-value">{{ high_potential_count }}</div>
<div class="stat-caption">{% trans "Candidates with Score ≥ 75 ({{ high_potential_ratio }}%)" %}</div>
<div class="stat-caption">{% trans "Candidates with Score ≥ 75%" %} ({{ high_potential_ratio }})</div>
</div>
<div class="card">