This repository has been archived on 2024-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
2020-10-17 22:39:07 -04:00

17 lines
577 B
Python

from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.views import generic
from django.urls import reverse
from django.utils import timezone
from .models import Migration
class IndexView(generic.ListView):
template_name = 'api/index.html'
context_object_name = 'latest_migrations'
def get_queryset(self):
"""Return the last five published questions (not including those set in the future)."""
return Migration.objects.filter(booked_time__gte=timezone.now()).order_by('-booked_time')[:5]