예제 #1
0
from blogs.views import HomeView, DetailView, AuthorView, CreateView, NotFoundView, MyBlogView, EditView
from users.views import LoginView, LogoutView, bloguersView, SignupView
from blogs.api import BlogListAPI, BlogDetailAPI
from users.api import UserDetailAPI, UserListlAPI
from django.contrib.auth.decorators import login_required

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),

    #blogs urls
    url(r'^$', HomeView.as_view(), name='blog_home'),
    url(r'^blogs/edit/(?P<ownerName>[a-zA-Z0-9]+)/(?P<pk>[0-9]+)$',
        login_required(EditView.as_view()),
        name='blog_edit'),
    url(r'^blogs/(?P<ownerName>[a-zA-Z0-9]+)/(?P<pk>[0-9]+)$',
        DetailView.as_view(),
        name='blog_detail'),
    url(r'^blogs/(?P<ownerName>[a-zA-Z0-9]+)$',
        AuthorView.as_view(),
        name='blog_owner'),
    url(r'^blogs/_new$',
        login_required(CreateView.as_view()),
        name='blog_create'),
    url(r'^blogs/_myBlogs$',
        login_required(MyBlogView.as_view()),
        name='blog_my'),

    # Users urls
    url(r'^blogs$', bloguersView.as_view(), name='blogers_list'),
    url(r'^login$', LoginView.as_view(), name='users_login'),
    url(r'^logout$', LogoutView.as_view(), name='users_logout'),
예제 #2
0
파일: urls.py 프로젝트: fdurmaz/blog
from django.contrib import admin
from django.urls import path

from blogs.views import IndexView, DetailView, FilterView

urlpatterns = [
    path('detail/<int:blog_id>/', DetailView.as_view(), name='detail'),
    path('', IndexView.as_view(), name='index'),
    path('admin/', admin.site.urls),
]
예제 #3
0
# -*- coding: utf-8 -*-

from django.conf.urls import url
from blogs.views import HomeView, BlogsView, UserPostsView, DetailView, CreateView

urlpatterns = [

    # Blogs URLs
    url(r'^$', HomeView.as_view(), name='blogs_home'),
    url(r'^blogs/$', BlogsView.as_view(), name='blogs_list'),
    url(r'^blogs/(?P<user>[A-Za-z0-9]+)$', UserPostsView.as_view(), name='user_posts'),
    url(r'^blogs/(?P<user>[A-Za-z0-9]+)/(?P<pk>[0-9]+)$', DetailView.as_view(), name='post_detail'),
    url(r'^blogs/new-post$', CreateView.as_view(), name='create_post'),
]
예제 #4
0
from django.conf.urls import include, url
from django.contrib import admin
from blogs.views import HomeView, DetailView, AuthorView, CreateView, NotFoundView, MyBlogView, EditView
from users.views import LoginView, LogoutView, bloguersView, SignupView
from blogs.api import BlogListAPI, BlogDetailAPI
from users.api import UserDetailAPI, UserListlAPI
from django.contrib.auth.decorators import login_required

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),

    #blogs urls
    url(r'^$', HomeView.as_view(), name='blog_home'),
    url(r'^blogs/edit/(?P<ownerName>[a-zA-Z0-9]+)/(?P<pk>[0-9]+)$', login_required(EditView.as_view()), name='blog_edit'),
    url(r'^blogs/(?P<ownerName>[a-zA-Z0-9]+)/(?P<pk>[0-9]+)$', DetailView.as_view(), name='blog_detail'),
    url(r'^blogs/(?P<ownerName>[a-zA-Z0-9]+)$', AuthorView.as_view(), name='blog_owner'),
    url(r'^blogs/_new$', login_required(CreateView.as_view()), name='blog_create'),
    url(r'^blogs/_myBlogs$', login_required(MyBlogView.as_view()), name='blog_my'),

    # Users urls
    url(r'^blogs$', bloguersView.as_view(), name='blogers_list'),
    url(r'^login$', LoginView.as_view(), name='users_login'),
    url(r'^logout$', LogoutView.as_view(), name='users_logout'),
    url(r'^singup$', SignupView.as_view(), name='users_singup'),

    # Blogs API URLs
    url(r'^api/1.0/blogs$', BlogListAPI.as_view(), name='blog_list_api'),
    url(r'^api/1.0/blogs/(?P<pk>[0-9]+)$', BlogDetailAPI.as_view(), name='blog_detail_api'),

    # Users API URLs
    url(r'^api/1.0/users$', UserListlAPI.as_view(), name='users_list_api'),