create detail page for job posting, show screening questions
This commit is contained in:
parent
25f045a68c
commit
73aedd193b
5 changed files with 44 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from .date_utils import after_30_days
|
||||
|
||||
|
@ -48,6 +49,9 @@ class Job(models.Model):
|
|||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse_lazy("jobs:job_detail", args=[self.id])
|
||||
|
||||
|
||||
class Question(models.Model):
|
||||
''' A model to hold screening questions for a job post '''
|
||||
|
|
30
jobs/templates/jobs/job_detail.html
Normal file
30
jobs/templates/jobs/job_detail.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{% extends 'base.html' %} {% block body_content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
|
||||
<h1 class="display-4">
|
||||
<a href="{{ job.get_absolute_url }}">{{ job.title }}</a>
|
||||
</h1>
|
||||
<p class="lead"></p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h6 class="card-subtitle mb-2 text-muted">
|
||||
{% for tag in job.tags.all %}
|
||||
<a href="#" class="badge badge-info h6">{{tag.name}}</a>
|
||||
{% endfor %}
|
||||
</h6>
|
||||
<p class="card-text">{{ job.description }}</p>
|
||||
{% for question in job.questions.all %}
|
||||
{% if forloop.counter0 == 0 %}
|
||||
<h5>Screening Questions:</h5>
|
||||
{% endif %}
|
||||
- {{question.name}} <br/>
|
||||
{% endfor %}
|
||||
<br/>
|
||||
<a href="#" class="card-link">Apply</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -9,7 +9,9 @@
|
|||
{% for job in jobs %}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">{{ job.title }}</h4>
|
||||
<h4 class="card-title">
|
||||
<a href="{{ job.get_absolute_url }}">{{ job.title }}</a>
|
||||
</h4>
|
||||
<h6 class="card-subtitle mb-2 text-muted">
|
||||
{% for tag in job.tags.all %}
|
||||
<a href="#" class="badge badge-info h6">{{tag.name}}</a>
|
||||
|
|
|
@ -8,6 +8,7 @@ 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/<int:pk>/detail/', views.JobDetail.as_view(), name='job_detail'),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.urls import reverse_lazy
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.views.generic import (
|
||||
TemplateView, ListView, CreateView
|
||||
TemplateView, ListView, CreateView, DetailView
|
||||
)
|
||||
|
||||
from .models import Job
|
||||
|
@ -17,6 +17,11 @@ class JobList(ListView):
|
|||
model = Job
|
||||
|
||||
|
||||
class JobDetail(DetailView):
|
||||
context_object_name = 'job'
|
||||
model = Job
|
||||
|
||||
|
||||
class JobCreate(CreateView):
|
||||
model = Job
|
||||
form_class = JobForm
|
||||
|
|
Loading…
Reference in a new issue