from django.conf.urls import url from django.views.generic.base import RedirectView from . import views urlpatterns = [ url( regex=r'^feed.xml', view=views.JrnlRSSFeedView(), name="feed" ), url( regex=r'(?P\d{4})/(?P\d{2})/(?P[-\w]+).txt$', view=views.EntryDetailViewTXT.as_view(), name="detail-txt" ), url( regex=r'(?P\d{4})/(?P\d{2})/(?P[-\w]+).amp$', view=views.EntryDetailViewAMP.as_view(), name="detail-amp" ), url( regex=r'(?P\d{4})/(?P\d{2})/(?P[-\w]+)$', view=views.EntryDetailView.as_view(), name="detail" ), url( regex=r'^(?P[0-9]{4})/(?P[0-9]{2})/$', view=views.EntryMonthArchiveView.as_view(month_format='%m'), name="list_month" ), url( regex=r'(?P\d{4})/$', view=views.EntryYearArchiveView.as_view(), name="list_year" ), url( regex=r'(?P[-\w]+)/(?P\d+)/$', view=views.EntryCountryList.as_view(), name="list_country" ), url( regex=r'(?P\d+)/$', view=views.EntryList.as_view(), name="list" ), # redirect /slug/ to /slug/1/ for live server url( regex=r'(?P[-\w]+)/$', view=RedirectView.as_view(url="/jrnl/%(slug)s/1/", permanent=False), name="live_location_redirect" ), # redirect / to /1/ for live server url( regex=r'', view=RedirectView.as_view(url="/jrnl/1/", permanent=False), name="live_redirect" ), ]