summaryrefslogtreecommitdiff
path: root/app/jrnl/urls.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-11-04 22:09:58 -0500
committerluxagraf <sng@luxagraf.net>2015-11-04 22:09:58 -0500
commit2311ea934932cf791a83f6c6264063a26468e98c (patch)
tree078381535dc2a1d6ee3dcbf8460b552748ce85ba /app/jrnl/urls.py
parent24b760797fd26e80c1738c614408b02b50284d4d (diff)
refactored blog app and renamed to jrnl
Diffstat (limited to 'app/jrnl/urls.py')
-rw-r--r--app/jrnl/urls.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/app/jrnl/urls.py b/app/jrnl/urls.py
new file mode 100644
index 0000000..d8fa395
--- /dev/null
+++ b/app/jrnl/urls.py
@@ -0,0 +1,44 @@
+from django.conf.urls import url
+from django.views.generic.base import RedirectView
+
+from . import views
+
+urlpatterns = [
+ url(
+ regex=r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$',
+ view=views.EntryDetailView.as_view(),
+ name="detail"
+ ),
+ url(
+ regex=r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$',
+ view=views.EntryMonthArchiveView.as_view(month_format='%m'),
+ name="list_month"
+ ),
+ url(
+ regex=r'(?P<year>\d{4})/$',
+ view=views.EntryYearArchiveView.as_view(),
+ name="list_year"
+ ),
+ url(
+ regex=r'(?P<slug>[-\w]+)/(?P<page>\d+)/$',
+ view=views.EntryCountryList.as_view(),
+ name="list_country"
+ ),
+ url(
+ regex=r'(?P<page>\d+)/$',
+ view=views.EntryList.as_view(),
+ name="list"
+ ),
+ # redirect /slug/ to /slug/1/ for live server
+ url(
+ regex=r'(?P<slug>[-\w]+)/$',
+ view=RedirectView.as_view(url="/jrnl/%(slug)s/1/"),
+ name="live_location_redirect"
+ ),
+ # redirect / to /1/ for live server
+ url(
+ regex=r'',
+ view=RedirectView.as_view(url="/jrnl/1/"),
+ name="live_redirect"
+ ),
+]