Add url for the latest publication
This commit is contained in:
parent
23466d3717
commit
dd95ce4c3c
2 changed files with 8 additions and 1 deletions
|
@ -8,4 +8,5 @@ urlpatterns = [
|
||||||
name='special_publications'),
|
name='special_publications'),
|
||||||
url(r'^(?P<year>\d{4})-(?P<nYear>\d{4})/',
|
url(r'^(?P<year>\d{4})-(?P<nYear>\d{4})/',
|
||||||
views.YearView.as_view(), name='year_view'),
|
views.YearView.as_view(), name='year_view'),
|
||||||
|
url(r'^latest$', views.latestPublication, name='latestPublication'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
|
||||||
|
@ -83,3 +83,9 @@ class SpecialPublicationsView(PublicationListView):
|
||||||
.filter(is_special=True)\
|
.filter(is_special=True)\
|
||||||
.order_by('-date')
|
.order_by('-date')
|
||||||
return publications
|
return publications
|
||||||
|
|
||||||
|
|
||||||
|
def latestPublication(req):
|
||||||
|
''' Redirects to the latest standard publication '''
|
||||||
|
latestPubli = Publication.latest()
|
||||||
|
return redirect(latestPubli.url)
|
||||||
|
|
Loading…
Reference in a new issue