summaryrefslogtreecommitdiff
path: root/app/blog/urls.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/blog/urls.py')
-rw-r--r--app/blog/urls.py59
1 files changed, 41 insertions, 18 deletions
diff --git a/app/blog/urls.py b/app/blog/urls.py
index eb69873..d8fa395 100644
--- a/app/blog/urls.py
+++ b/app/blog/urls.py
@@ -1,21 +1,44 @@
-from django.conf.urls import *
+from django.conf.urls import url
from django.views.generic.base import RedirectView
-"""
-urlpatterns = patterns('',
- (r'(?P<slug>[-\w]+)/(?P<page>\d+)/$', 'blog.views.entry_list_by_area'),
- (r'(?P<page>\d+)/$', 'blog.views.entry_list'),
- (r'(?P<slug>[-\w]+)/$', RedirectView.as_view(url="/writing/%(slug)s/1/")),
- (r'', RedirectView.as_view(url="/writing/1/")),
-)
-"""
+from . import views
-urlpatterns = patterns('',
- url(r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', 'blog.views.entry_detail'),
- url(r'(?P<year>\d{4})/(?P<month>\d{2})/$', 'blog.views.date_list', name="blog_by_month"),
- url(r'(?P<year>\d{4})/$', 'blog.views.date_list', name="blog_by_year"),
- (r'(?P<slug>[-\w]+)/(?P<page>\d+)/$', 'blog.views.entry_list_by_area'),
- (r'(?P<page>\d+)/$', 'blog.views.entry_list'),
- url(r'(?P<slug>[-\w]+)/$', RedirectView.as_view(url="/jrnl/%(slug)s/1/")),
- url(r'', RedirectView.as_view(url="/jrnl/1/")),
-)
+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"
+ ),
+]