""" from django.contrib import admin from django.urls import path from blogs.api import BlogListApi, PostDetailListView, PostListModelView, PostDetailView, PostListView, PostSaveView from blogs.views import PostList, BlogList, PostUserList, PostDetail, CreatePost from users.api import UserViewSet, UserDetailViewSet from users.views import Login, Logout, Signup urlpatterns = [ path('admin/', admin.site.urls, name='admin'), path('', PostList.as_view(), name='home'), path('blogs/', BlogList.as_view(), name='blog_list'), path('blogs/<str:usr>/', PostUserList.as_view(), name='blog_user_list'), path('blogs/<str:usr>/<int:pk>', PostDetail.as_view(), name='blog_post_detail'), path('new-post', CreatePost.as_view(), name='new-post'), path('login', Login.as_view(), name='login'), path('logout', Logout.as_view(), name='logout'), path('signup', Signup.as_view(), name='signup'), path('api/v1/blogs', BlogListApi.as_view(), name='api-blogs-list'), path('api/v1/user/', UserViewSet.as_view(), name='api-user-reg'), path('api/v1/user/<int:pk>', UserDetailViewSet.as_view(), name='api-user-detail'), path('api/v1/blog/<int:pk>', PostDetailListView.as_view(), name='api-post-list'), path('api/v1/post/', PostListView.as_view(), name='api-post-save'), path('api/v1/post/<int:pk>', PostDetailView.as_view(), name='api-post-detail')
from django.contrib import admin from django.urls import path from blogs.api import BlogsListAPI, PostListAPI, PostDetailAPI from blogs.views import PostList, BlogList, BlogDetail, PostDetail, CreatePost from users.api import UsersListAPI, UserDetailAPI from users.views import LoginView, LogoutView, SingupView urlpatterns = [ path('', PostList.as_view(), name="home_page"), path('login/', LoginView.as_view(), name="user_login"), path('logout/', LogoutView.as_view(), name="user_logout"), path('signup/', SingupView.as_view(), name="user_singup"), path('new-post/', CreatePost.as_view(), name="create_post"), path('blogs/<str:user>/<int:pk>/', PostDetail.as_view(), name="post_detail"), path('blogs/<str:user>', BlogDetail.as_view(), name="blog_detail"), path('blogs/', BlogList.as_view(), name="blog_list"), path('admin/', admin.site.urls), # API REST path('api/1.0/users/', UsersListAPI.as_view(), name="api_users_list"), path('api/1.0/users/<int:pk>', UserDetailAPI.as_view(), name="api_user_detail"), path('api/1.0/blogs/', BlogsListAPI.as_view(), name="api_blogs_list"), path('api/1.0/posts/', PostListAPI.as_view(), name="api_post_list"), path('api/1.0/posts/<int:pk>', PostDetailAPI.as_view(), name="api_post_detail")
def test_PostDetail_context_auth(self): post_detail_url1 = reverse('post_detail', kwargs={'pk':self.obj1.pk}) request = self.factory.get(post_detail_url1) request.user=self.user response= PostDetail.as_view()(request, pk=self.obj1.pk) self.assertIsNotNone(response.context_data['like'])
from django.conf.urls import url from blogs.views import PostList, BlogList, BlogDetail, PostDetail, NewPost, PostReply urlpatterns = [ url(r'^$', PostList.as_view(), name='latest_posts'), url(r'^new-post/?$', NewPost.as_view(), name='new_post'), url(r'^blogs/?$', BlogList.as_view(), name='blog_list'), url(r'^blogs/(?P<username>[a-zA-Z0-9_]+)/?$', BlogDetail.as_view(), name="blog_detail"), url(r'^blogs/(?P<username>[a-zA-Z0-9_]+)/(?P<pk>[0-9]+)/?$', PostDetail.as_view(), name="post_detail"), url(r'^blogs/(?P<username>[a-zA-Z0-9_]+)/(?P<pk>[0-9]+)/reply/?$', PostReply.as_view(), name="post_reply"), ]
# coding=utf-8 from django.conf.urls import url, include from blogs.views import BlogList, BlogDetail, PostDetail, CreateBlog, UpdateBlog, CreatePost, UpdatePost, UpdateBlogDiv, UpdatePostDiv, \ LikeCountView, LikeView, CategoryView, PostLikeAjaxView, PostCommentDetail from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt urlpatterns = [ url(r'^$', BlogList.as_view(), name="blog_list"), url(r'^newblog/', login_required(CreateBlog.as_view()), name="addblog"), url(r'^(?P<pk>\d+)/edit/$', login_required(UpdateBlog.as_view()), name="editblog"), url(r'^(?P<pk>\d+)/$', BlogDetail.as_view(), name="blogDetail"), url(r'^posts/(?P<pk>\d+)/$', PostDetail.as_view(), name="postDetail"), url(r'^ckeditor/', include('ckeditor_uploader.urls'), name="meow"), url(r'^newpost/', login_required(CreatePost.as_view()), name="addpost"), url(r'^posts/(?P<pk>\d+)/edit/$', login_required(UpdatePost.as_view()), name="editpost"), url(r'^(?P<pk>\d+)/editdiv/$', login_required(UpdateBlogDiv.as_view()), name="editblogdiv"), url(r'^posts/(?P<pk>\d+)/editdiv/$', login_required(UpdatePostDiv.as_view()), name="editpostdiv"), url(r'^posts/(?P<pk>\d+)/likes/$', csrf_exempt(PostLikeAjaxView.as_view()), name="likecount"), url(r'posts/likes/$', LikeView.as_view(), name="likes"), url(r'^posts/(?P<pk>\d+)/comments/$',
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from django.contrib.auth.decorators import login_required from blogs.views import PostList, BlogList, NewPostView, PostDetail from users.views import LoginView, LogoutView urlpatterns = [ url(r'^$', PostList.as_view(), name="posts_list"), url(r'^admin/', admin.site.urls), url(r'^login$', LoginView.as_view(), name="login"), url(r'^logout$', LogoutView.as_view(), name='logout'), url(r'^blogs/$', BlogList.as_view(), name="blog_list"), url(r'^blogs/(?P<username>[\w.@+-]+)/$', PostList.as_view(), name="posts_list"), #url(r'^blogs/(?P<username>[a-zA-Z0-9_]+)/?$', BlogDetail.as_view(), name="blog_detail"), url(r'^blogs/(?P<username>[a-zA-Z0-9_]+)/(?P<pk>[0-9]+)/?$', login_required(PostDetail.as_view()), name="post_detail"), url(r'^blogs/new-post/?$', login_required(NewPostView.as_view()), name="new_post"), #url(r'^posts/(?P<post_pk>[0-9]+)$', posts_detail, name="posts_detail"), ]
from django.conf.urls import patterns, url from rest_framework.urlpatterns import format_suffix_patterns from blogs.views import PostDetail, PostList urlpatterns = patterns('', url(r'^$', PostList.as_view()), url(r'^(?P<pk>[0-9]+)/$', PostDetail.as_view()), ) urlpatterns = format_suffix_patterns(urlpatterns)