diff --git a/jobs/urls.py b/jobs/urls.py index 775f526..e8dcf0f 100644 --- a/jobs/urls.py +++ b/jobs/urls.py @@ -6,4 +6,5 @@ urlpatterns = [ path('', HomeView.as_view(), name="home"), path('create-job/', CreateJobView.as_view(), name="create_job"), path('detail///', SingleJobView.as_view(), name="single_job"), + path('category-detail///', CategoryDetailView.as_view(), name="category_detail"), ] diff --git a/jobs/views.py b/jobs/views.py index 56ada04..07ad79c 100644 --- a/jobs/views.py +++ b/jobs/views.py @@ -1,5 +1,6 @@ from django.contrib.auth.decorators import login_required from django.contrib.messages.views import SuccessMessageMixin +from django.shortcuts import get_object_or_404 from django.utils.decorators import method_decorator from django.views.generic import TemplateView, ListView, CreateView, DetailView @@ -12,7 +13,7 @@ class HomeView(ListView): template_name = 'jobs/index.html' context_object_name = 'jobs' model = Job - paginate_by = 1 + paginate_by = 3 def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) @@ -44,3 +45,22 @@ class SingleJobView(DetailView): context = super(SingleJobView, self).get_context_data(**kwargs) context['categories'] = Category.objects.all() return context + + +class CategoryDetailView(ListView): + model = Job + template_name = 'jobs/category-detail.html' + context_object_name = 'jobs' + paginate_by = 2 + + def get_queryset(self): + self.category = get_object_or_404(Category, pk=self.kwargs['pk']) + return Job.objects.filter(category=self.category) + + def get_context_data(self, *args, **kwargs): + context = super(CategoryDetailView, self).get_context_data(*args, **kwargs) + self.category = get_object_or_404(Category, pk=self.kwargs['pk']) + context['categories'] = Category.objects.all() + context['category'] = self.category + return context + diff --git a/templates/jobs/category-detail.html b/templates/jobs/category-detail.html new file mode 100644 index 0000000..ca6cae2 --- /dev/null +++ b/templates/jobs/category-detail.html @@ -0,0 +1,476 @@ +{% extends 'base.html' %} +{% load static %} +{% block content %} + +
+
+
+
+
+

We have 0 great job offers you deserve!

+

Your Dream
Job is Waiting

+ + +
+
+
+
+ +
+
+
+
+
+
+
+

Search Millions of Jobs

+

A small river named Duden flows by their place and supplies.

+
+
+
+
+
+
+
+

Easy To Manage Jobs

+

A small river named Duden flows by their place and supplies.

+
+
+
+
+
+
+
+

Top Careers

+

A small river named Duden flows by their place and supplies.

+
+
+
+
+
+
+
+

Search Expert Candidates

+

A small river named Duden flows by their place and supplies.

+
+
+
+
+
+
+ +
+
+
+
+ Results for {{ category.title }} +

Current jobs for {{ category.title }}

+
+
+
+ {% for category in categories %} + + {% endfor %} + +
+
+
+ +
+
+
+
+ Recently Added Jobs +

Recent Jobs

+
+
+
+ {% for job in jobs %} +
+
+ +
+
+

{{ job.title }}

+
+ {% if job.job_type == 'full_time' %} + Full Time + {% elif job.job_type == 'part_time'%} + Part Time + {% elif job.job_type == 'freelance'%} + Freelance + {% elif job.job_type == 'internship'%} + Internship + {% elif job.job_type == 'temporary'%} + Temporary + {% endif %} +
+
+
+ +
{{ job.location }}
+
+
+ + + +
+
+ {% endfor %} + + +
+
+ {% if is_paginated %} +
+
+
    + {% if page_obj.has_previous %} +
  • <
  • + {% else %} +
  • <
  • + {% endif %} + {% for i in paginator.page_range %} + {% if page_obj.number == i %} +
  • {{ i }}
  • + {% else %} +
  • {{ i }}
  • + {% endif %} + {% endfor %} + {% if page_obj.has_next %} +
  • >
  • + {% else %} +
  • >
  • + {% endif %} +
+
+
+ {% endif %} +
+
+
+ +
+
+
+
+
+
+
+
+ 0 + Jobs +
+
+
+
+
+
+ 0 + Members +
+
+
+
+
+
+ 0 + Resume +
+
+
+
+
+
+ 0 + Company +
+
+
+
+
+
+
+
+ + +
+
+
+
+ Testimonial +

Happy Clients

+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ Our Blog +

Recent Blog

+
+
+
+
+
+ + +
+ +

Even the all-powerful Pointing has no control about the blind texts

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias architecto enim non iste maxime optio, ut com

+
+
+
+
+
+ + +
+ +

Even the all-powerful Pointing has no control about the blind texts

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet nobis natus incidunt officia assumenda.

+
+
+
+
+
+ + +
+ +

Even the all-powerful Pointing has no control about the blind texts

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Excepturi obcaecati praesentium,

+
+
+
+
+
+ + +
+ +

Even the all-powerful Pointing has no control about the blind texts

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolor minima, dolores quis, dolorum accusamu

+
+
+
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/jobs/index.html b/templates/jobs/index.html index e014548..cd0f77b 100644 --- a/templates/jobs/index.html +++ b/templates/jobs/index.html @@ -181,7 +181,7 @@ {% for category in categories %} {% endfor %}