Basically a fork from https://github.com/blochberger/sokman but with the intention of adding a visual interface as well
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
964 B
31 lines
964 B
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})
|
|
|
|
|