from django.db.models import F from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.views import generic from sok.models import Publication, PublicationReference class IndexView(generic.ListView): template_name = "tag/index.html" context_object_name = "newest_publications" def get_queryset(self): return Publication.objects.order_by("-year")[:10] def detail(request, cite_key): try: publication = get_object_or_404(Publication, cite_key=cite_key.strip('/')) except Publication.DoesNotExist: raise Http404("Publication does not exist") return render(request, "tag/detail.html", {"publication": publication}) # def overview(request): # try: # ps = Publication.objects.get(...) # except Publication.DoesNotExist: # raise Http404("Publication does not exist") # return render(request, "publications/overview.html", {"to_tag": ps})