diff --git a/website/templates/base.html b/website/templates/base.html index 412eea7..3d9872c 100644 --- a/website/templates/base.html +++ b/website/templates/base.html @@ -2,41 +2,35 @@ {% load static %} - - - - {% block seo_header %} - {% block title %}Pingojo - Crowd-Powered Hiring {% endblock %} - - - {% endblock %} - - - - - - - - - - {% if production %} - - {% endif %} - - {% block extra_css %} - - {% endblock %} - {% block extra_head %} - {% endblock %} - - - - - -
- - - {% block logo %} - -
- - Pingojo Logo +
+ {% block logo %} + +
+ + Pingojo Logo - Say goodbye to no-reply -
- - {% endblock %} - - - -
-
- - + +
+ + + + + + + - - - - - - + + - -
- - - - -
- - - -{% if messages %} -
- {% for message in messages %} -
- {{ message }} -
- {% endfor %} -
-{% endif %} - - - -{% block content %} - {% endblock %} - + {% if messages %} +
+ {% for message in messages %}
{{ message }}
{% endfor %} +
+ {% endif %} + {% block content %}{% endblock %} + - - - - - - {% block extra_js %} - - {% endblock %} - - {% block script %} - - {% endblock %} - - + + {% block extra_js %} + {% endblock %} + {% block script %}{% endblock %} + diff --git a/website/views.py b/website/views.py index bfaba61..26c138a 100644 --- a/website/views.py +++ b/website/views.py @@ -677,11 +677,18 @@ def dispatch(self, *args, **kwargs): def get_queryset(self): if not self.queryset: + search_type = self.request.GET.get("search_type", "").strip() search_query = re.sub( r"[^a-zA-Z0-9,. ]", "", self.request.GET.get("search", "").strip() ) - if search_query: + if search_type == "skill": + # If search_type is 'skill', return jobs matching the skill + skill_name = search_query + self.queryset = Job.objects.filter(skills__name__icontains=skill_name).select_related("company", "role").distinct() + + elif search_query: + # For general search query query = SearchQuery(search_query) queryset = ( Job.objects.select_related("company", "role") @@ -695,10 +702,10 @@ def get_queryset(self): job_count = self.queryset.count() search = Search(query=search_query, matched_job_count=job_count) search.save() - # send_slack_notification(search) else: self.queryset = Job.objects.select_related("company", "role").all() else: + # Default queryset if no search term is provided self.queryset = Job.objects.select_related("company", "role").order_by( F("posted_date").desc(nulls_last=True) ) @@ -716,7 +723,7 @@ def get_queryset(self): applied_jobs = Application.objects.filter( user=self.request.user ).values_list("job_id", flat=True) - queryset = self.queryset.exclude(id__in=applied_jobs) + self.queryset = self.queryset.exclude(id__in=applied_jobs) ordering = self.request.GET.get("ordering") if ordering and ordering.lstrip("-") in [ @@ -752,6 +759,7 @@ def get_context_data(self, **kwargs): return context + class SourceListView(ListView): model = Source template_name = "sources.html"