#-*- coding: utf-8 -*-
__author__ = 'daviddetena'

# -*- coding: utf-8 -*-
from django.conf.urls import url
from blogs.views import HomeView, BlogListView, BlogDetailView, PostDetailView, CreateView

urlpatterns = [
    # Blogs URLs
    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^blogs/$', BlogListView.as_view(), name='blog_list'),
    url(r'^blogs/(?P<username>[a-z]+)$', BlogDetailView.as_view(), name='blog_detail'),
    url(r'^blogs/(?P<username>[a-z]+)/(?P<pk>[0-9]+)', PostDetailView.as_view(), name='post_detail'),
    url(r'^new-post/$', CreateView.as_view(), name='post_create'),
]
예제 #2
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'),
예제 #3
0
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from blogs.api import PostViewSet, BlogsViewSet
from blogs.views import HomeView, BlogView, PostFormView, PostView, BlogsView
from users.api import UserViewSet
from users.views import LoginView, LogoutView, SignupView

router = DefaultRouter()
router.register('users', UserViewSet)
router.register('blogs', BlogsViewSet, base_name='blogs')
router.register('posts', PostViewSet, base_name='posts')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', HomeView.as_view(), name='home'),
    path('blogs/', BlogsView.as_view(), name='blogslist'),
    path('blogs/<owner>/', BlogView.as_view(), name='user-blog'),
    path('blogs/<owner>/<int:pk>/', PostView.as_view(), name='user-post'),
    path('new-post/', PostFormView.as_view(), name='new-post'),
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
    path('signup/', SignupView.as_view(), name='signup'),
    path('api/v1/', include(router.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #4
0
"""wordplease URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
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. 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, include

from blogs.views import HomeView, PostCreationView

urlpatterns = [
    url(r'^$', HomeView.as_view(), name='posts_home'),
    url(r'^create$', PostCreationView.as_view(), name='posts_create')
]
예제 #5
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'),
]