X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9f46cd8bd84b9d2cd3febd80b3906260314de43f..3257903f562b02fdb4c45b4bf84002b72f42e377:/apps/catalogue/views.py?ds=sidebyside diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 89232ea0..c7189d47 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, date, timedelta import logging import os from StringIO import StringIO @@ -70,8 +70,20 @@ def users(request): @active_tab('activity') -def activity(request): - return render(request, 'catalogue/activity.html') +def activity(request, isodate=None): + today = date.today() + try: + day = helpers.parse_isodate(isodate) + except ValueError: + day = today + + if day > today: + raise Http404 + if day != today: + next_day = day + timedelta(1) + prev_day = day - timedelta(1) + + return render(request, 'catalogue/activity.html', locals()) @never_cache @@ -324,9 +336,13 @@ def chunk_edit(request, slug, chunk): else: form = forms.ChunkForm(instance=doc) - parts = urlsplit(request.META['HTTP_REFERER']) - parts = ['', ''] + list(parts[2:]) - go_next = urlquote_plus(urlunsplit(parts)) + referer = request.META.get('HTTP_REFERER') + if referer: + parts = urlsplit(referer) + parts = ['', ''] + list(parts[2:]) + go_next = urlquote_plus(urlunsplit(parts)) + else: + go_next = '' return direct_to_template(request, "catalogue/chunk_edit.html", extra_context={ "chunk": doc,