Commit 73aedd19 authored by Aatish Neupane's avatar Aatish Neupane

create detail page for job posting, show screening questions

parent 25f045a6
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 '''
......
{% 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 %}
\ No newline at end of file
......@@ -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'),
]
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment