diff --git a/home/templates/dashboard/navbar.html b/home/templates/dashboard/navbar.html
index dd200f2..89b3b0b 100644
--- a/home/templates/dashboard/navbar.html
+++ b/home/templates/dashboard/navbar.html
@@ -9,6 +9,7 @@
display: none;
position: absolute;
left: 100%;
+ top: 0;
margin-top: 5;
}
@@ -89,7 +90,13 @@
Difficulty »
-
+
+
+
+ Status »
+
+
+
+
diff --git a/home/urls.py b/home/urls.py
index d9b9985..9c575a3 100644
--- a/home/urls.py
+++ b/home/urls.py
@@ -24,4 +24,6 @@
path('contact/', views.contact_form, name='contact_form'),
path('like//', views.likes, name='like_issue'),
path('dislike//', views.dislikes, name='dislike_issue'),
+ path('filter_by_status//',
+ views.filter_by_status, name='filter_by_status'),
]
diff --git a/home/views.py b/home/views.py
index e349aa8..5c3807d 100644
--- a/home/views.py
+++ b/home/views.py
@@ -128,6 +128,49 @@ def filter_by_difficulty(request, difficulty_level=None):
return render(request, 'dashboard/index.html', context=context)
+@complete_profile_required
+def filter_by_status(request, status=None):
+ """
+ Filter the issues on basis of their open or close status.
+ params: selected filter option
+ return:
+ """
+ issues_qs = Issue.objects.all()
+ project_qs = Project.objects.all()
+
+ if status and status != 'All':
+ status_mapping = {
+ 'Open': Issue.OPEN,
+ 'Closed': Issue.CLOSED
+ }
+ if status in status_mapping:
+ issues_qs = issues_qs.filter(state=status_mapping[status])
+
+ domains_qs = Domain.objects.all()
+ subdomains_qs = SubDomain.objects.all()
+
+ curr_domain = request.GET.get('domain', 'All')
+ curr_subdomain = request.GET.get('subdomain', 'All')
+
+ if curr_domain != 'All':
+ issues_qs = issues_qs.filter(project__domain__name=curr_domain)
+
+ if curr_subdomain != 'All':
+ issues_qs = issues_qs.filter(project__subdomain__name=curr_subdomain)
+
+ context = {
+ 'projects': project_qs,
+ 'issues': issues_qs,
+ 'domains': domains_qs,
+ 'subdomains': subdomains_qs,
+ 'curr_domain': curr_domain,
+ 'curr_subdomain': curr_subdomain,
+ 'curr_status': status if status else 'All'
+ }
+
+ return render(request, 'dashboard/index.html', context=context)
+
+
def authorize(request):
"""
Used for rendering authorize.html which is responsible for both LogIn and SignUp
diff --git a/project/migrations/0042_alter_issue_levelcolor.py b/project/migrations/0042_alter_issue_levelcolor.py
new file mode 100644
index 0000000..9f96b84
--- /dev/null
+++ b/project/migrations/0042_alter_issue_levelcolor.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.1 on 2024-10-24 16:35
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('project', '0041_issue_levelcolor'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='issue',
+ name='levelcolor',
+ field=models.PositiveSmallIntegerField(choices=[(0, '#f2f2f2'), (4, '#39c0ed'), (1, '#00b74a'), (2, '#ffa900'), (3, '#f93154')], default=1, verbose_name='Level Color'),
+ ),
+ ]