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