display 3 jobs in home

This commit is contained in:
aatish 2018-10-26 15:20:08 +05:45
parent d13d3f53d5
commit be949448c5
2 changed files with 12 additions and 39 deletions

View file

@ -5,50 +5,18 @@
<p class="lead"></p>
</div>
<div class="card-deck mb-3 text-center">
{% for job in jobs %}
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Free</h4>
<h4 class="my-0 font-weight-normal"><a href="{{ job.get_absolute_url }}">{{ job.title }}</a></h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$0 <small class="text-muted">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-outline-primary">Sign up for free</button>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Pro</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$15 <small class="text-muted">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>20 users included</li>
<li>10 GB of storage</li>
<li>Priority email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Enterprise</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$29 <small class="text-muted">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>30 users included</li>
<li>15 GB of storage</li>
<li>Phone and email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Contact us</button>
<p class="card-text">{{ job.description|truncatewords_html:20 }}</p>
</div>
<div class="card-footer">
<a href="{% url 'jobs:job_apply' job.pk %}" class="btn btn-lg btn-block btn-primary">Apply</a>
</div>
</div>
{% endfor %}
</div>
{% endblock %}

View file

@ -15,6 +15,11 @@ from .forms import JobForm, QuestionFormSet, ApplicationForm, AnswerForm
class Index(TemplateView):
template_name = 'jobs/index.html'
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context['jobs'] = Job.objects.all().order_by('-updated')[:3]
return context
class JobList(ListView):
context_object_name = 'jobs'