djangocms_blog/djangocms_blog/urls.py

46 lines
1.4 KiB
Python
Raw Normal View History

2014-01-04 16:07:09 +00:00
# -*- coding: utf-8 -*-
2015-09-12 22:46:05 +00:00
from __future__ import absolute_import, print_function, unicode_literals
2015-10-20 05:51:37 +00:00
from django.conf.urls import url
2015-10-18 09:45:00 +00:00
2016-04-23 19:17:51 +00:00
from .feeds import FBInstantArticles, LatestEntriesFeed, TagFeed
2015-09-26 23:38:59 +00:00
from .settings import get_setting
2015-09-12 22:33:13 +00:00
from .views import (
AuthorEntriesView, CategoryEntriesView, PostArchiveView, PostDetailView, PostListView,
TaggedListView,
)
2014-01-04 16:07:09 +00:00
def get_urls():
urls = get_setting('PERMALINK_URLS')
details = []
for urlconf in urls.values():
details.append(
url(urlconf, PostDetailView.as_view(), name='post-detail'),
)
return details
2016-12-03 22:20:00 +00:00
detail_urls = get_urls()
2015-10-19 13:06:37 +00:00
urlpatterns = [
2015-09-12 22:33:13 +00:00
url(r'^$',
PostListView.as_view(), name='posts-latest'),
url(r'^feed/$',
LatestEntriesFeed(), name='posts-latest-feed'),
2016-04-23 19:17:51 +00:00
url(r'^feed/fb/$',
FBInstantArticles(), name='posts-latest-feed-fb'),
2015-09-12 22:33:13 +00:00
url(r'^(?P<year>\d{4})/$',
PostArchiveView.as_view(), name='posts-archive'),
url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/$',
PostArchiveView.as_view(), name='posts-archive'),
url(r'^author/(?P<username>[\w\.@+-]+)/$',
AuthorEntriesView.as_view(), name='posts-author'),
url(r'^category/(?P<category>[\w\.@+-]+)/$',
CategoryEntriesView.as_view(), name='posts-category'),
url(r'^tag/(?P<tag>[-\w]+)/$',
TaggedListView.as_view(), name='posts-tagged'),
url(r'^tag/(?P<tag>[-\w]+)/feed/$',
TagFeed(), name='posts-tagged-feed'),
2015-10-19 13:06:37 +00:00
] + detail_urls