Verified Commit 0e38b50a authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Remove legacy redirect

parent 863bb59e
......@@ -10,6 +10,4 @@ urlpatterns = [
url(r'^(?P<pk>\d+)/(?P<lang>[-\w]+)/$', views.preview,
url(r'admin/send/(?P<pk>\d+)/$', views.admin_send, name='admin-send'),
views.legacy_redirect, name='legacy-redirect')
"""Views provided by the newsletters package"""
import os
from datetime import datetime, timedelta, date
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
......@@ -55,26 +54,6 @@ def preview(request, pk, lang=None):
def legacy_redirect(request, year, week):
View that redirect you to the right newsletter by
using the previously used URL format of /{year}/{week}
:param request: the request object
:param year: the year of the newsletter
:param week: the week of the newsletter
:return: 302 RedirectResponse
newsletter_date = datetime.strptime(
'%s-%s-1' % (year, week), '%Y-%W-%w')
if date(int(year), 1, 4).isoweekday() > 4:
newsletter_date -= timedelta(days=7)
newsletter = get_object_or_404(Newsletter, date=newsletter_date)
return redirect(newsletter.get_absolute_url(), permanent=True)
def admin_send(request, pk):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment