urlpatterns = [

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

    #Posts URLs
    url(r'^$', HomeView.as_view(), name='posts_home'),
    url(r'^blogs/(?P<pk>[-\w]+)/(?P<idPost>[0-9]+)/$', DetailPostView.as_view(), name='post_detail'),
    url(r'^new-post$', CreatePostView.as_view(), name='create_post'),
    url(r'^update-post/(?P<pk>[-\w]+)/(?P<idPost>[0-9]+)/$', UpdatePostView.as_view(), name='update_post'),

    # Posts API URLs
    # Listado de posts para la home/Creacion de un post nuevo
    url(r'api/1.0/posts/$', PostListAPI.as_view(), name='post_list_api'),

    #Blogs URLs
    url(r'^blogs/$', BlogsView.as_view(), name='blogs'),
    url(r'^blogs/(?P<pk>[-\w]+)/$', DetailBlogView.as_view(), name='blog_detail'),

    # Blogs API URLs
    # Listado de blogs
    url(r'api/1.0/blogs/$', BlogsListAPI.as_view(), name='blog_list_api'),
    # Detalle de un blog: listado de posts del blog
    url(r'api/1.0/blogs/(?P<pk>[-\w]+)/$', BlogDetailAPI.as_view(), name='blog_detail_api'),
    # Detalle/Actualizacion/Borrado de un post
    url(r'api/1.0/blogs/(?P<pk>[-\w]+)/(?P<idPost>[0-9]+)/$', PostDetailAPI.as_view(), name='blog_detail_api'),

    #Users URLs
    url(r'^login', LoginView.as_view(), name='users_login'),
    url(r'^logout', LogoutView.as_view(), name='users_logout'),
    url(r'^signup', SignupView.as_view(), name='users_signup'),
from blogs.api import BlogListAPI
from django.conf.urls import include, url
from django.contrib import admin
from posts.api import PostListAPI, PostDetailAPI
from posts.views import HomeView, UserPostsView, DetailView, CreateView
from users.api import UserListAPI, UserDetailAPI
from users.views import LoginView, LogoutView, SignupView
from blogs.views import BlogsView

urlpatterns = [
    # (?P<pk>[0-9]+) => valor en parámetro pk (?P<pk>), que será 1 o más números del 0 al 9

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

    # urls nombradas
    url(r'^blogs/$', BlogsView.as_view(), name='blog_home'),    # listado de blogs, con vista basada en clase BlogsView
    url(r'^$', HomeView.as_view(), name='post_home'),           # listado de posts publicados, con vista basada en clase HomeView
    url(r'^blogs/(?P<username>[a-z]+)/$', UserPostsView.as_view(), name='blog_posts'),     # listado posts blog usuario, basada en la clase UserPostView
    url(r'^blogs/(?P<username>[a-zA-Z]+)/(?P<post_id>[0-9]+)$', DetailView.as_view(), name='post_detail'),   # detalle post, basado en clase DetailView


    url(r'^signup/$', SignupView.as_view(), name='user_signup'), # signup o creación de cuenta de usuario, con vista basada en clase SignupView
    url(r'^login$', LoginView.as_view(), name='user_login'),    # login, con vista basada en clase LoginView
    url(r'^logout$', LogoutView.as_view(), name='user_logout'), # logout, con vista basada en clase LogoutView

    url(r'^new-post/$', CreateView.as_view(), name='post_create'),   # creación nuevo post, con vista basada en clase CreateView


    # Users' API URLs
    url(r'^api/1.0/users/$', UserListAPI.as_view(), name='user_list_api'),      # url con listado de users para la API, basado en clases
    url(r'^api/1.0/users/(?P<pk>[0-9]+)$', UserDetailAPI.as_view(), name='user_detail_api'),     #url detalle usuario para la api
Beispiel #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)
Beispiel #4
0
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 blogs.api import BlogsAPI, PostsAPI, PostDetailAPI, UserBlogAPI
from blogs.views import LatestPostsView, BlogsView, UserBlogView, PostDetailView, NewPostView
from users.api import UsersAPI, UserDetailAPI
from users.views import LoginView, SignupView, logout

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', LatestPostsView.as_view(), name='index'),
    url(r'^blogs/$', BlogsView.as_view(), name='blogs'),
    url(r'^blogs/(?P<username>[0-9a-zA-Z_-]+)/$',
        UserBlogView.as_view(),
        name='user_blog'),
    url(r'^blogs/(?P<username>[0-9a-zA-Z_-]+)/(?P<pk>[0-9]+)/$',
        PostDetailView.as_view(),
        name='post_detail'),
    url(r'^new-post/$', NewPostView.as_view(), name='new_post'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^signup/$', SignupView.as_view(), name='signup'),
    url(r'^logout/$', logout, name='logout'),

    # API Users
    url(r'^api/1.0/users/$', UsersAPI.as_view(), name='users_api'),
    url(r'^api/1.0/users/(?P<pk>[0-9]+)/$',
        UserDetailAPI.as_view(),
Beispiel #5
0
"""pure_dj_apis URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from blogs.views import (get_blogs, create_blog, update_blog)
from django.views.decorators.csrf import csrf_exempt
from blogs.views import BlogsView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('fn/blogs/', get_blogs),
    path('blogs/create/', csrf_exempt(create_blog)),
    path('blogs/update/', csrf_exempt(update_blog)),
    path('blogs/', csrf_exempt(BlogsView.as_view())),
]
Beispiel #6
0
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from schedule.views import ScheduleView, CurrentShowView
from bannerplus.views import BannerPlusView
from residents.views import ResidentsView, SingleResidentView, SearchResidentsView
from blogs.views import BlogsView, SingleBlogView, SearchBlogsView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/schedule', ScheduleView.as_view()),
    path('api/schedule/currentshow', CurrentShowView.as_view()),
    path('api/residents', ResidentsView.as_view()),
    path('api/residents/<id>', SingleResidentView.as_view()),
    path('api/residents/search/<search>', SearchResidentsView.as_view()),
    path('api/banner', BannerPlusView.as_view()),
    path('api/blogs', BlogsView.as_view()),
    path('api/blogs/<id>', SingleBlogView.as_view()),
    path('api/blogs/search/<search>', SearchBlogsView.as_view()),
]
Beispiel #7
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from blogs.api import BlogViewSet
from blogs.views import BlogsView, BlogDetailView, NewBlogView

router = DefaultRouter()
router.register('blogs', BlogViewSet)

urlpatterns = [
    path('blogs', BlogsView.as_view(), name='blogs'),
    path('blogs/<int:pk>/', BlogDetailView.as_view(), name='detail_blog'),
    path('new-blog', NewBlogView.as_view(), name='new-blog'),

    # API REST
    path('api/1.0/', include(router.urls)),
]
Beispiel #8
0
from django.conf.urls import url
from blogs.views import BlogsView, PostsView, PostDetailView

urlpatterns = [
    url(r'^$', BlogsView.as_view(), name='blogs_list'),
    url(r'^(?P<username>[0-9A-z]\w+)$',
        PostsView.as_view(),
        name='posts_of_user_blog'),
    url(r'^(?P<username>[0-9A-z]\w+)/(?P<pk>[0-9]+)/$',
        PostDetailView.as_view(),
        name='post_user_detail'),
]
Beispiel #9
0
"""DjangoBlogs URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from blogs.views import IndexView, BlogsView, AddCommentsView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', IndexView.as_view(), name='index'),
    re_path(r'^blog/(?P<blog_id>\d+)/$',
            BlogsView.as_view(),
            name="blog_detail"),
    path('add_comment/', AddCommentsView.as_view(), name="add_comment")
]