jobportal/jobs/views.py
2020-12-31 15:10:53 +01:00

16 lines
418 B
Python

from django.views.generic import TemplateView, ListView
from jobs.models import Job, Category
class HomeView(ListView):
template_name = 'jobs/index.html'
context_object_name = 'jobs'
model = Job
paginate_by = 1
def get_context_data(self, **kwargs):
context = super(HomeView, self).get_context_data(**kwargs)
context['categories'] = Category.objects.all()
return context