Files
fet2020/fet2020/blackboard/views.py
2021-01-15 15:42:30 +00:00

23 lines
668 B
Python

from django.shortcuts import render
from django.utils import timezone
from datetime import timedelta
from .models import JobPosting
from posts.models import Post
def index(request):
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 = {
"job_postings": job_postings,
"bb_info": bb_info,
"bb_empty": bb_empty,
}
return render(request, "blackboard/index.html", context)