From d1c66f054caf1af438653b87086b6cc946611a50 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 30 Dec 2020 13:52:05 +0000 Subject: [PATCH 1/2] blackboard: add text as a post --- fet2020/blackboard/views.py | 12 ++++++++++-- fet2020/posts/views.py | 1 + fet2020/templates/blackboard/index.html | 12 ++++++++++-- .../{_jobPosting.html => _show_job_posting.html} | 0 fet2020/templates/layout.html | 2 +- 5 files changed, 22 insertions(+), 5 deletions(-) rename fet2020/templates/blackboard/partials/{_jobPosting.html => _show_job_posting.html} (100%) diff --git a/fet2020/blackboard/views.py b/fet2020/blackboard/views.py index c51eff0e..093728ef 100644 --- a/fet2020/blackboard/views.py +++ b/fet2020/blackboard/views.py @@ -4,11 +4,19 @@ from django.utils import timezone from datetime import timedelta from .models import JobPosting +from posts.models import Post def index(request): - jobPost_cutoff = timezone.now().date() - timedelta(30) # 30days from now + job_postings_cutoff = timezone.now().date() - timedelta(30) # 30days from now + job_postings = JobPosting.all_jobPosting.filter(publishDate__gt=job_postings_cutoff) + bb_info = Post.objects.filter(slug='blackboard').first() + bb_empty = Post.objects.filter(slug='blackboard-empty').first() + context = { - "jobPostings": JobPosting.all_jobPosting.filter(publishDate__gt=jobPost_cutoff), + "job_postings": job_postings, + "bb_info": bb_info, + "bb_empty": bb_empty, } + return render(request, 'blackboard/index.html', context) diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index 6188ffeb..73f161be 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -35,6 +35,7 @@ def index(request): return render(request, "posts/index.html", {"posts": posts, "tags_list": t}) + def calendar(request): events = deque(Post.objects.all_post_with_date().all()) return render( diff --git a/fet2020/templates/blackboard/index.html b/fet2020/templates/blackboard/index.html index 6ae266ac..670d9361 100644 --- a/fet2020/templates/blackboard/index.html +++ b/fet2020/templates/blackboard/index.html @@ -5,9 +5,17 @@

Blackboard

+ {% if bb_info %} + {{ bb_info.body|safe }} + {% endif %} + + {% if bb_empty and not job_postings %} + {{ bb_empty.body|safe }} + {% endif %} +
- {% for job in jobPostings %} - {% include 'blackboard/partials/_jobPosting.html' %} + {% for job in job_postings %} + {% include 'blackboard/partials/_show_job_posting.html' %} {% endfor %}
diff --git a/fet2020/templates/blackboard/partials/_jobPosting.html b/fet2020/templates/blackboard/partials/_show_job_posting.html similarity index 100% rename from fet2020/templates/blackboard/partials/_jobPosting.html rename to fet2020/templates/blackboard/partials/_show_job_posting.html diff --git a/fet2020/templates/layout.html b/fet2020/templates/layout.html index bfcfb388..c82f2b55 100644 --- a/fet2020/templates/layout.html +++ b/fet2020/templates/layout.html @@ -79,7 +79,7 @@ footer {
From 7fbd64f092cd86d89867fa2bfccc872f1e7d4887 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 30 Dec 2020 13:54:56 +0000 Subject: [PATCH 2/2] fix new line --- fet2020/posts/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index 73f161be..6188ffeb 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -35,7 +35,6 @@ def index(request): return render(request, "posts/index.html", {"posts": posts, "tags_list": t}) - def calendar(request): events = deque(Post.objects.all_post_with_date().all()) return render(