25 lines
732 B
Python
25 lines
732 B
Python
from datetime import timedelta
|
|
|
|
from django.shortcuts import render
|
|
from django.utils import timezone
|
|
|
|
from core.models import CustomFlatPage
|
|
from .models import JobPosting
|
|
|
|
|
|
def index(request):
|
|
job_postings_cutoff = timezone.now().date() - timedelta(30) # 30days from now
|
|
job_postings = JobPosting.all_job_postings.filter(
|
|
publish_date__gt=job_postings_cutoff
|
|
)
|
|
bb_info = CustomFlatPage.objects.filter(title__iexact="blackboard").first()
|
|
bb_empty = CustomFlatPage.objects.filter(title__iexact="blackboard empty").first()
|
|
|
|
context = {
|
|
"job_postings": job_postings,
|
|
"bb_info": bb_info,
|
|
"bb_empty": bb_empty,
|
|
}
|
|
|
|
return render(request, "blackboard/index.html", context)
|