From be949448c566344ae57d895f54fbbe7e445fbbae Mon Sep 17 00:00:00 2001 From: Aatish Neupane Date: Fri, 26 Oct 2018 15:20:08 +0545 Subject: [PATCH] display 3 jobs in home --- jobs/templates/jobs/index.html | 46 ++++++---------------------------- jobs/views.py | 5 ++++ 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/jobs/templates/jobs/index.html b/jobs/templates/jobs/index.html index 026511a..953d9b6 100644 --- a/jobs/templates/jobs/index.html +++ b/jobs/templates/jobs/index.html @@ -5,50 +5,18 @@

+ {% for job in jobs %}
-

Free

+

{{ job.title }}

-

$0 / mo

-
    -
  • 10 users included
  • -
  • 2 GB of storage
  • -
  • Email support
  • -
  • Help center access
  • -
- -
-
-
-
-

Pro

-
-
-

$15 / mo

-
    -
  • 20 users included
  • -
  • 10 GB of storage
  • -
  • Priority email support
  • -
  • Help center access
  • -
- -
-
-
-
-

Enterprise

-
-
-

$29 / mo

-
    -
  • 30 users included
  • -
  • 15 GB of storage
  • -
  • Phone and email support
  • -
  • Help center access
  • -
- +

{{ job.description|truncatewords_html:20 }}

+
+
+ {% endfor %}
{% endblock %} \ No newline at end of file diff --git a/jobs/views.py b/jobs/views.py index 028bfa6..748c801 100644 --- a/jobs/views.py +++ b/jobs/views.py @@ -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'