diff --git a/jobs/templates/base.html b/jobs/templates/base.html index e7ea03f..778754c 100644 --- a/jobs/templates/base.html +++ b/jobs/templates/base.html @@ -16,9 +16,9 @@ - Post a job + Post a job
diff --git a/jobs/templates/jobs/application_list.html b/jobs/templates/jobs/application_list.html new file mode 100644 index 0000000..0a8c89c --- /dev/null +++ b/jobs/templates/jobs/application_list.html @@ -0,0 +1,31 @@ +{% extends 'base.html' %} +{% block body_content %} +
+
+
+

Applications

+

+
+ {% for application in applications %} +
+
+

+ Submitted by: {{ application.applicant }} +

+

+ Submitted: {{ application.created }} +

+

+ {{ application.cover_text }} +

+
    + {% for answer in application.answers.all %} +
  1. {{answer.question}}

    {{answer.text}}

  2. + {% endfor %} +
+
+
+ {% endfor %} +
+
+{% endblock %} \ No newline at end of file diff --git a/jobs/templates/jobs/job_detail.html b/jobs/templates/jobs/job_detail.html index bddc41b..86e1fb3 100644 --- a/jobs/templates/jobs/job_detail.html +++ b/jobs/templates/jobs/job_detail.html @@ -26,6 +26,10 @@
{% has_perm 'jobs.change_job' request.user job as can_change_job %} {% if can_change_job %} + + + Applications ({{job.applications.count}}) +
{% csrf_token %} diff --git a/jobs/urls.py b/jobs/urls.py index 4d27051..526ed99 100644 --- a/jobs/urls.py +++ b/jobs/urls.py @@ -6,11 +6,12 @@ from . import autocomplete as autocomplete_views app_name = 'jobs' urlpatterns = [ path('', views.Index.as_view(), name='index'), - path('jobs/create/', views.JobCreate.as_view(), name='create'), - path('jobs/', views.JobList.as_view(), name='list'), + path('jobs/create/', views.JobCreate.as_view(), name='job_create'), + path('jobs/', views.JobList.as_view(), name='job_list'), path( 'jobs//detail/', views.JobDetail.as_view(), name='job_detail'), path('jobs//renew/', views.JobRenew.as_view(), name='job_renew'), + path('jobs//applications/', views.ApplicationList.as_view(), name='job_applications'), path( 'jobs//apply/', views.ApplicationCreate.as_view(), diff --git a/jobs/views.py b/jobs/views.py index 89af17f..e2eab4e 100644 --- a/jobs/views.py +++ b/jobs/views.py @@ -126,3 +126,15 @@ class ApplicationCreate(CreateView): def form_invalid(self, form, answer_form): return self.render_to_response( self.get_context_data(form=form, answer_form=answer_form)) + + +class ApplicationList(ListView): + model = Application + context_object_name = 'applications' + + def get_queryset(self): + return super().get_queryset().filter(job_id=self.kwargs['job_pk']) + + +class ApplicationDetail(DetailView): + model = Application