djangocms_blog/djangocms_blog/urls.py

46 lines
1.4 KiB
Python
Raw Normal View History

2014-01-04 17:07:09 +01:00
# -*- coding: utf-8 -*-
2015-09-13 00:46:05 +02:00
from __future__ import absolute_import, print_function, unicode_literals
2015-10-20 07:51:37 +02:00
from django.conf.urls import url
2015-10-18 11:45:00 +02:00
2016-04-23 21:17:51 +02:00
from .feeds import FBInstantArticles, LatestEntriesFeed, TagFeed
2015-09-27 01:38:59 +02:00
from .settings import get_setting
2015-09-13 00:33:13 +02:00
from .views import (
AuthorEntriesView, CategoryEntriesView, PostArchiveView, PostDetailView, PostListView,
TaggedListView,
)
2014-01-04 17:07:09 +01: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 23:20:00 +01:00
detail_urls = get_urls()
2015-10-19 15:06:37 +02:00
urlpatterns = [
2015-09-13 00:33:13 +02:00
url(r'^$',
PostListView.as_view(), name='posts-latest'),
url(r'^feed/$',
LatestEntriesFeed(), name='posts-latest-feed'),
2016-04-23 21:17:51 +02:00
url(r'^feed/fb/$',
FBInstantArticles(), name='posts-latest-feed-fb'),
2015-09-13 00:33:13 +02: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 15:06:37 +02:00
] + detail_urls