Пример #1
0
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from photos.views import HomeView, DetailView, CreateView, PhotoListView, UserPhotosView

urlpatterns = [
    #Photo urls
    url(r'^$', HomeView.as_view(), name='photos_home'),
    url(r'^my-photos/$', login_required(UserPhotosView.as_view()), name='user_photos'),
    url(r'^photos/$', PhotoListView.as_view(), name='photos_list'),
    url(r'^photos/(?P<pk>[0-9]+)$', DetailView.as_view(), name='photo_detail'),
    url(r'^photos/new$', CreateView.as_view(), name='create_photo'),
]
Пример #2
0
from django.contrib import admin
from django.contrib.auth.decorators import login_required

from photos.api import PhotoDetailAPI, PhotoListAPI
from photos.views import CreateView, DetailView, HomeView, PhotoListView, \
    UserPhotosView
from users.api import UserDetailAPI, UserListAPI
from users.views import LoginView, LogoutView

# r le dice que es una expresion regular  -^ iniciode cadena - $ fin de cadena
urlpatterns = [
    url(r'^admin/', admin.site.urls),

    #Photo URLs
    url(r'^$', HomeView.as_view(), name="photos_home"),
    url(r'^photos/(?P<pk>[0-9]+)/$', DetailView.as_view(),
        name="photo_detail"),
    url(r'^photos/new/$', CreateView.as_view(), name="photo_create"),
    url(r'^photos/$', PhotoListView.as_view(), name="photos_list"),
    url(r'^my-photos/$',
        login_required(UserPhotosView.as_view()),
        name="user_photos"),

    #Photos API URLs
    url(r'^api/1.0/photos/$', PhotoListAPI.as_view(), name='photo_list_api'),
    url(r'^api/1.0/photos/(?P<pk>[0-9]+)/$',
        PhotoDetailAPI.as_view(),
        name='photo_detail_api'),

    #Users URLs
    url(r'^login$', LoginView.as_view(), name='users_login'),
Пример #3
0
from django.urls import path

from photos.views import (
    HomeView,
    DetailView,
    CreatePhotoView,
    ListPhotoView,
    UserPhotoView,
)

urlpatterns = [

    # Photos
    path('', HomeView.as_view(), name='home'),
    path('photo/<pk>', DetailView.as_view(), name='detail'),
    path('photo/create/', CreatePhotoView.as_view(), name='photo_create'),
    path('photo/list/', ListPhotoView.as_view(), name='photo_list'),
    path('<username>/my_photos/', UserPhotoView.as_view(), name='user_photos'),
]
Пример #4
0
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from photos.views import HomeView, DetailView, CreateView, PhotoListView, UserPhotosView


urlpatterns = [
    # Photos URLs
    url(r'^$', HomeView.as_view(), name='photos_home'),
    url(r'^my-photos/$', login_required(UserPhotosView.as_view()), name='user_photos'),
    url(r'^photos/$', PhotoListView.as_view(), name='photos_list'),
    url(r'^photos/(?P<pk>[0-9]+)$', DetailView.as_view(), name='photo_detail'),
    url(r'photos/new$', CreateView.as_view(), name='create_photo'),
]
Пример #5
0
from django.urls import path
from photos.views import HomeView, DetailView, CreateView, PhotoListView, UserPhotosView
from django.contrib.auth.decorators import login_required
from django.conf.urls import include, url

urlpatterns = [
    path('', HomeView.as_view(), name='photos_home'),
    path('my-photos/', login_required(UserPhotosView.as_view()), name='user_photos'),
    path('photos/', PhotoListView.as_view(), name='photos_list'),
    path('photos/(<pk>)', DetailView.as_view(), name='photo_detail'),
    path('photos/new_photo', CreateView.as_view(), name='create_photo'),
]