Example #1
0
    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),

    # Home page with 5 posts per page
    url(r'^(?P<page>\d+)?/?$', ListView.as_view(
        model=Post,
        paginate_by=5,
    )),

    # Blog posts URL
    url(r'^\d{4}/\d{1,2}/(?P<postSlug>[-a-zA-Z0-9]+)/?$',
        'blogengine.views.getPost'),

    # Categories URL
    url(r'^categories/?$', ListView.as_view(model=Category, )),
    url(r'^categories/(?P<categorySlug>\w+)/?$',
        'blogengine.views.getCategory'),
    url(r'^categories/(?P<categorySlug>\w+)/(?P<selected_page>\d+)/?$',
        'blogengine.views.getCategory'),

    # Comments URL
    url(r'^comments/', include('django.contrib.comments.urls')),

    # RSS feeds URL
    url(r'^feeds/posts/$', PostsFeed()),

    # Flat pages URL
    url(r'', include('django.contrib.flatpages.urls')),
)
Example #2
0
     ),

    # Index Blog - Posts List
    re_path(r'^(?P<page>\d+)?/?$',
     PostListView.as_view(
        paginate_by=7
        ), name = 'post_list'),       # Generic ListView

    # Individual posts - Post Detail
    re_path(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
     DetailView.as_view()),

    # Categories - Posts List by Category
    path(r'category/<slug:slug>/',
     CategoryListView.as_view(
        paginate_by=5,
        model=Category,
        ), name = 'category_list'),

    # Tags - Posts List by Tag
    path(r'tag/<slug:slug>/',
     TagListView.as_view(
        paginate_by=5,
        model=Tag,
        ), name = 'tag_list'),

    # Posts RSS feed
    path('feeds/posts/', PostsFeed()),

]