Beispiel #1
0
from django.conf.urls import url
from django.contrib.sitemaps.views import sitemap

from views import ArticleListView, ArticlePublishView, ArticleDetailView, ArticleEditView, BlogSitemap

urlpatterns = [
    url(r'^$', ArticleListView.as_view(), name='blog_index'),
    url(r'^article/publish$',
        ArticlePublishView.as_view(),
        name='article_publish'),
    url(r'^article/(?P<title>\w+\.?\w+)$',
        ArticleDetailView.as_view(),
        name='article_detail'),
    url(r'^article/(?P<title>\w+\.?\w+)/edit$',
        ArticleEditView.as_view(),
        name='article_edit'),

    #sitemap
    url(r'^sitemap\.xml$',
        sitemap, {'sitemaps': {
            'blog': BlogSitemap
        }},
        name='django.contrib.sitemaps.views.sitemap')
]
Beispiel #2
0
from django.conf.urls import url
from django.contrib.sitemaps.views import sitemap

from views import ArticleListView, ArticlePublishView, ArticleDetailView, ArticleEditView, BlogSitemap

urlpatterns = [
    url(r'^$', ArticleListView.as_view(), name='blog_index'),
    url(r'^article/publish$', ArticlePublishView.as_view(), name='article_publish'),
    url(r'^article/(?P<title>\w+\.?\w+)$', ArticleDetailView.as_view(), name='article_detail'),
    url(r'^article/(?P<title>\w+\.?\w+)/edit$', ArticleEditView.as_view(), name='article_edit'),

    #sitemap
    url(r'^sitemap\.xml$', sitemap, {'sitemaps': {'blog': BlogSitemap}}, name='django.contrib.sitemaps.views.sitemap')
]
Beispiel #3
0
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""

from django.conf.urls import url
from django.contrib.sitemaps.views import sitemap

from views import ArticleListView, ArticlePublishView, ArticleDetailView, ArticleEditView, BlogSitemap

#from . import views

urlpatterns = [

    url(r'^$', ArticleListView.as_view(), name='blog_index'),
    url(r'^article/publish$', ArticlePublishView.as_view(), name='article_publish'),
    url(r'^article/(?P<title>\w+\.?\w+)$', ArticleDetailView.as_view(), name='article_detail'),
    url(r'^article/(?P<title>\w+\.?\w+)/edit$', ArticleEditView.as_view(), name='article_edit'),

    # sitemap
    url(r'^sitemap\.xml$', sitemap, {'sitemaps': {'blog': BlogSitemap}}, name='django.contrib.sitemaps.views.sitemap')

]
Beispiel #4
0
from django.conf.urls import include, url,patterns
from . import views

from views import ArticlePublishView,ArticlePublishView2

#patterns or error will occur str' object has no attribute 'resolve' django
urlpatterns = patterns('',
    #url(r'^article/(?P<id>\d+)/$','zard.views.content'),
    url(r'^$','zard.views.index'),
    url(r'^login/$','zard.views.login'),
    url(r'^signin/$','zard.views.signin'),
    url(r'^logoff/$','zard.views.logout'),
    url(r'^dropup/$','zard.views.dropup'),
    url(r'^marks/$','zard.views.marks'),
    url(r'^articles/(?P<caption>.+)/$','zard.views.article'),
    url(r'^publish/$',ArticlePublishView.as_view()),
    url(r'^articles/$','zard.views.articles'),
    url(r'^publish2/$',ArticlePublishView2.as_view()),
    #url(r'^articles/(?P<caption>.+)/edit$','zard.views.publish_article'),


)
Beispiel #5
0
from django.conf.urls import include, url, patterns
from . import views

from views import ArticlePublishView, ArticlePublishView2

#patterns or error will occur str' object has no attribute 'resolve' django
urlpatterns = patterns(
    '',
    #url(r'^article/(?P<id>\d+)/$','zard.views.content'),
    url(r'^$', 'zard.views.index'),
    url(r'^login/$', 'zard.views.login'),
    url(r'^signin/$', 'zard.views.signin'),
    url(r'^logoff/$', 'zard.views.logout'),
    url(r'^dropup/$', 'zard.views.dropup'),
    url(r'^marks/$', 'zard.views.marks'),
    url(r'^articles/(?P<caption>.+)/$', 'zard.views.article'),
    url(r'^publish/$', ArticlePublishView.as_view()),
    url(r'^articles/$', 'zard.views.articles'),
    url(r'^publish2/$', ArticlePublishView2.as_view()),
    #url(r'^articles/(?P<caption>.+)/edit$','zard.views.publish_article'),
)