コード例 #1
0
from django.contrib.auth.views import login
from django.contrib.auth.views import logout
from accounts.views import UserRegistrationView
from blog.views import NewBlogView
from blog.views import HomeView
from blog.views import UpdateBlogView
from blog.views import NewBlogPostView
from blog.views import UpdateBlogPostView
from blog.views import BlogPostDetailsView
from blog.views import SharePostWithBlog
from blog.views import StopSharingPostWithBlog
from blog.views import ShareBlogPostView


urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^new-user/$', UserRegistrationView.as_view(), name='user_registration'),
    url(r'^login/$', login, {'template_name': 'login.html'}, name='login'),
    url(r'^logout/$', logout, {'next_page': '/login/'}, name='logout'),

    url(r'^blog/new/$', NewBlogView.as_view(), name='new-blog'),
    url(r'^blog/(?P<pk>\d+)/update/$', UpdateBlogView.as_view(), name='update-blog'),
    url(r'blog/post/new/$', NewBlogPostView.as_view(), name='new-blog-post'),
    url(r'blog/post/(?P<pk>\d+)/update/$', UpdateBlogPostView.as_view(), name='update-blog-post'),
    url(r'blog/post/(?P<pk>\d+)/$', BlogPostDetailsView.as_view(), name='blog-post-details'),
    url(r'blog/post/(?P<pk>\d+)/share/$', ShareBlogPostView.as_view(), name='share-blog-post-with-blog'),
    url(r'blog/post/(?P<post_pk>\d+)/share/to/(?P<blog_pk>\d+)/$', SharePostWithBlog.as_view(), name='share-post-with-blog'),
    url(r'blog/post/(?P<post_pk>\d+)/stop/share/to/(?P<blog_pk>\d+)/$', StopSharingPostWithBlog.as_view(), name='stop-sharing-post-with-blog'),
]
コード例 #2
0
urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^new-user/$',
        UserRegistrationView.as_view(),
        name='user_registration'),
    url(r'^login/$', login, {'template_name': 'login.html'}, name='login'),
    url(r'^logout/$', logout, {'next_page': '/login/'}, name='logout'),
    url(r'^blog/new/$', NewBlogView.as_view(), name='new-blog'),
    url(r'^blog/(?P<pk>\d+)/update/$',
        UpdateBlogView.as_view(),
        name='update-blog'),
    url(r'blog/post/new/$', NewBlogPostView.as_view(), name='new-blog-post'),
    url(r'blog/post/(?P<pk>\d+)/update/$',
        UpdateBlogPostView.as_view(),
        name='update-blog-post'),
    url(r'blog/post/(?P<pk>\d+)/$',
        BlogPostDetailsView.as_view(),
        name='blog-post-details'),
    url(r'blog/post/(?P<pk>\d+)/share/$',
        ShareBlogPostView.as_view(),
        name='share-blog-post-with-blog'),
    url(r'blog/post/(?P<post_pk>\d+)/share/to/(?P<blog_pk>\d+)/$',
        SharePostWithBlog.as_view(),
        name='share-post-with-blog'),
    url(r'blog/post/(?P<post_pk>\d+)/stop/share/to/(?P<blog_pk>\d+)/$',
        StopSharingPostWithBlog.as_view(),
        name='stop-sharing-post-with-blog'),
]
コード例 #3
0
from django.contrib.auth.views import LoginView,LogoutView
from django.urls import path, include
from django.views.generic import TemplateView
from accounts.views import UserRegistrationView
from blog.views import (
    HomeView,
    NewBlogView, 
    UpdateBlogView,
    BlogPostDetailView, 
    NewBlogPostView,
    UpdateBlogPostView, 
    ShareBlogPostView,
    SharePostWithBlog,
    StopShareingPostWithBlog,
)
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', HomeView.as_view(),name = 'home'),
    path('new-user/', UserRegistrationView.as_view(), name = 'user_registration'),
    path('login/', LoginView.as_view(template_name = 'login.html'), name = 'login'),
    path('logout/', LogoutView.as_view(next_page = '/login/'), name = 'logout'),
    path('blog/new/', NewBlogView.as_view(), name = 'new_blog'),
    path('blog/<int:pk>/update/', UpdateBlogView.as_view(), name = 'update_blog'),
    path('blog/post/<int:pk>/', BlogPostDetailView.as_view(), name = 'blog_post_details'),
    path('blog/post/new/', NewBlogPostView.as_view(), name = 'new_blog_post'),
    path('blog/post/<int:pk>/update/', UpdateBlogPostView.as_view(), name = 'update_blog_post'),
    path('blog/post/<int:pk>/share/', ShareBlogPostView.as_view(), name = 'share_blog_post'),
    path('blog/post/<int:post_pk>/share/to/<int:blog_pk>/', SharePostWithBlog.as_view(), name = 'share_post_with_blog'),
    path('blog/post/<int:post_pk>/stop/share/to/<int:blog_pk>/', StopShareingPostWithBlog.as_view(), name = 'stop_sharing_post_with_blog'),
]