From 8bfa53a7b837b07b8b52d3bdf78592299365d290 Mon Sep 17 00:00:00 2001 From: Gokuldevx Date: Mon, 25 Aug 2025 15:14:20 +0530 Subject: [PATCH] minor update --- .../core/__pycache__/models.cpython-313.pyc | Bin 8494 -> 8494 bytes .../core/__pycache__/urls.cpython-313.pyc | Bin 1804 -> 1897 bytes .../core/__pycache__/views.cpython-313.pyc | Bin 15635 -> 16016 bytes civicfix/core/models.py | 1 - civicfix/core/templates/core/base.html | 16 ++++- .../dashboard/department_dashboard.html | 56 ++++++++++++++++++ .../dashboard/superadmin_dashboard.html | 1 - civicfix/core/urls.py | 4 +- civicfix/core/views.py | 12 +++- 9 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 civicfix/core/templates/dashboard/department_dashboard.html diff --git a/civicfix/core/__pycache__/models.cpython-313.pyc b/civicfix/core/__pycache__/models.cpython-313.pyc index 145a2a62e833302b67051a6c127d6ecb8ca672f4..a1defd5351389a873a5205cf6fca57f833d2e15d 100644 GIT binary patch delta 149 zcmZ4Iw9bk5GcPX}0}yoStjRFn$eYH;=&-qjubPpudh!Q;6CkN7aEP&P@(Y1qj7^&# z3&t}twr+M7E@x!y+Pqt&gAu6OMXZ8}anj_y5>brPCre1i0LfCx2aK~Ohe<7GoV59$ z)Fwv8xsx}_v@tH3Y$2-yBvWNKFfN}gCO4OH)#NR58yV+rPLuCvWE7bEO~C>Hu-G&$ delta 149 zcmZ4Iw9bk5GcPX}0}#lotjX}+$eYH;=(xFrubPpuX7UGq6CkN7aEP&f@(Y1qjLn-L z3&t}twrzG6E@x!y-n?6+gAu6OMXZ8}aq{H75>bpZCQC@h0LfCx2aK~Phe<7GoV@v; z)Fwv8d6PHFv@tH7Y$2-yBvWNKFs_&^CO4OH_2eyb8yV+qPLuCvWE7hGO~C>HgD^AW diff --git a/civicfix/core/__pycache__/urls.cpython-313.pyc b/civicfix/core/__pycache__/urls.cpython-313.pyc index 136a0af6da75d6612ab0d60b58ea788f18369df8..b8179ac0e332853f1f1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whx4Ao19?H`>30vyXlR+)MiY+kOc}YseYpgu>9yc!PC6?2XvNh AZU6uP diff --git a/civicfix/core/models.py b/civicfix/core/models.py index c3b25cf..36dcebc 100644 --- a/civicfix/core/models.py +++ b/civicfix/core/models.py @@ -61,7 +61,6 @@ class IssueCategory(models.Model): def __str__(self): return self.name -# issues/models.py class Issue(models.Model): STATUS_REPORTED = 'reported' STATUS_ACKNOWLEDGED = 'acknowledged' diff --git a/civicfix/core/templates/core/base.html b/civicfix/core/templates/core/base.html index 0173209..5e59ead 100644 --- a/civicfix/core/templates/core/base.html +++ b/civicfix/core/templates/core/base.html @@ -75,6 +75,7 @@ +
{% if user.is_authenticated %} {% else %} + Login Register {% endif %}
+ diff --git a/civicfix/core/templates/dashboard/department_dashboard.html b/civicfix/core/templates/dashboard/department_dashboard.html new file mode 100644 index 0000000..16a50e2 --- /dev/null +++ b/civicfix/core/templates/dashboard/department_dashboard.html @@ -0,0 +1,56 @@ +{% extends "core/base.html" %} + +{% block content %} +
+
+
+

Department Dashboard

+

Welcome, {{ request.user.username }}. Your Departments: + {% for dept in departments %} {{ dept.name }}{% if not forloop.last %}, {% endif %}{% endfor %} +

+
+
+ {% if issues %} + + + + + + + + + + + + + {% for issue in issues %} + + + + + + + + + {% endfor %} + +
#TitleCategoryReported ByStatusCreated At
{{ forloop.counter }}{{ issue.title }}{{ issue.category.name|default:"—" }}{{ issue.reporter.username }} + {% if issue.status == "reported" %} + Reported + {% elif issue.status == "acknowledged" %} + Acknowledged + {% elif issue.status == "in_progress" %} + In Progress + {% elif issue.status == "resolved" %} + Resolved + {% else %} + Unknown + {% endif %} + {{ issue.created_at|date:"M d, Y H:i" }}
+ {% else %} +

No issues assigned to your departments yet.

+ {% endif %} +
+
+
+{% endblock %} diff --git a/civicfix/core/templates/dashboard/superadmin_dashboard.html b/civicfix/core/templates/dashboard/superadmin_dashboard.html index 0ab3c71..76f9beb 100644 --- a/civicfix/core/templates/dashboard/superadmin_dashboard.html +++ b/civicfix/core/templates/dashboard/superadmin_dashboard.html @@ -1,4 +1,3 @@ - {% extends "core/base.html" %} {% block content %} diff --git a/civicfix/core/urls.py b/civicfix/core/urls.py index 1565a84..c90588d 100644 --- a/civicfix/core/urls.py +++ b/civicfix/core/urls.py @@ -9,7 +9,6 @@ urlpatterns = [ path("superadmin/departments//", views.department_detail, name="department_detail"), path("superadmin/manage/", views.manage_issues, name="manage_issues"), path("superadmin/assign-department//", views.assign_department, name="assign_department"), - path('register/', views.register, name='register'), path('login/', views.custom_login, name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), @@ -19,5 +18,6 @@ urlpatterns = [ path("issues//", views.issue_detail, name="issue_detail"), path("issues//comment/", views.add_comment, name="add_comment"), path("issues//comment//", views.add_comment, name="add_comment"), - path('vote//', views.vote_issue, name='vote_issue'), + path('vote//', views.vote_issue, name='vote_issue'), + path("department/", views.department_dashboard, name="department_dashboard"), ] \ No newline at end of file diff --git a/civicfix/core/views.py b/civicfix/core/views.py index 760396e..33fda57 100644 --- a/civicfix/core/views.py +++ b/civicfix/core/views.py @@ -239,7 +239,7 @@ def department_detail(request, pk): email=email, password=password ) - user.is_staff = True + user.is_resolver = True user.save() department.users.add(user) messages.success(request, f"User '{username}' created and added to department.") @@ -301,4 +301,12 @@ def assign_department(request, issue_id): else: messages.error(request, "Please select a department.") - return redirect("manage_issues") # redirect back to the issues page \ No newline at end of file + return redirect("manage_issues") + +def resolver_check(user): + return user.is_resolver + +@login_required +@user_passes_test(resolver_check) +def department_dashboard(request): + return render(request, "dashboard/department_dashboard.html") \ No newline at end of file