18 lines
480 B
Python
18 lines
480 B
Python
from datetime import timedelta
|
|
|
|
from django.shortcuts import render
|
|
from django.utils import timezone
|
|
|
|
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)
|
|
|
|
context = {
|
|
"job_postings": job_postings.order_by("-publish_date"),
|
|
}
|
|
|
|
return render(request, "blackboard/index.html", context)
|