Пример #1
0
from django.conf.urls import url
from views import Index, Log, Reg, Main, Logout, AddToCart, Checkout, ShowCart

urlpatterns = [
    url(r'^$', Index.as_view()),
    url(r'^login$', Log.as_view()),
    url(r'^logout$', Logout.as_view()),
    url(r'^register$', Reg.as_view()),
    url(r'^main$', Main.as_view()),
    url(r'^cart$', AddToCart.as_view()),
    url(r'^showcart$', ShowCart.as_view()),
    url(r'^checkout$', Checkout.as_view()),
    ]
Пример #2
0
from django.conf.urls import url

from django.contrib import admin
admin.autodiscover()

from views import Main, Detail

app_name = "blog"

urlpatterns = [

    # Main view with optional page
    url(r'^$', Main.as_view(), name="Home"),
    url(r'^page/(?P<page>\d+)$', Main.as_view(), name="Home"),

    # Direct access by slug (one article - no paging)
    url(r'^article/(?P<slug>[\w-]+)$', Detail.as_view(), name="Detail"),

    # Search by tag (main article - supports paging)
    url(r'^search/(?P<tag_slug>[\w-]+)$', Main.as_view(), name="Search"),
    url(r'^search/(?P<tag_slug>[\w-]+)/page/(?P<page>\d+)$', Main.as_view(), name="Search"),

    # Search by date with paging
    url(r'^archive/(?P<year>\d{4})/$', Main.as_view(), name="Archive"),
    url(r'^archive/(?P<year>\d{4})/page/(?P<page>\d+)$', Main.as_view(), name="Archive"),
    url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})$', Main.as_view(), name="Archive"),
    url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/page/(?P<page>\d+)$', Main.as_view(), name="Archive"),
]
Пример #3
0
from django.conf.urls import url

from django.contrib import admin
admin.autodiscover()

from views import Main, Detail

app_name = "blog"

urlpatterns = [

    # Main view with optional page
    url(r'^$', Main.as_view(), name="Home"),
    url(r'^page/(?P<page>\d+)$', Main.as_view(), name="Home"),

    # Direct access by slug (one article - no paging)
    url(r'^article/(?P<slug>[\w-]+)$', Detail.as_view(), name="Detail"),

    # Search by tag (main article - supports paging)
    url(r'^search/(?P<tag_slug>[\w-]+)$', Main.as_view(), name="Search"),
    url(r'^search/(?P<tag_slug>[\w-]+)/page/(?P<page>\d+)$',
        Main.as_view(),
        name="Search"),

    # Search by date with paging
    url(r'^archive/(?P<year>\d{4})/$', Main.as_view(), name="Archive"),
    url(r'^archive/(?P<year>\d{4})/page/(?P<page>\d+)$',
        Main.as_view(),
        name="Archive"),
    url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})$',
        Main.as_view(),