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 include, url from django.contrib import admin from photos.views import HomeView, DetailView, CreateView, ListView from users.views import LoginView, LogoutView #from django.conf.urls.defaults import * urlpatterns = [ #(r'^admin/', include('django.contrib.admin.urls')), #url('index/', views.index, name='main-view'), #url(r'^home/$', 'photos.views.home',name='home'), #url(r'^$', include('photos.views.home')), #Admin url(r'^admin/', admin.site.urls), #Photos #url(r'^$', home, name='photos_home'), url(r'^$', HomeView.as_view(), name='photos_home'), url(r'^photos/$', ListView.as_view()), url(r'^photos/(?P<pk>[0-9]+)$', DetailView.as_view(), name='photo_detail'), url(r'^photos/new$', CreateView.as_view(), name='photo_create'), # Users url(r'^login$', LoginView.as_view(), name='users_login'), url(r'^logout$', LogoutView.as_view(), name='users_logout') ]
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'), ]
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'), url(r'^logout$', LogoutView.as_view(), name='users_logout'),
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'), ]
from django.urls import path from photos.views import HomeView, PhotoListView, PhotoDetailView, CreateView, UserPhotosView from django.contrib.auth.decorators import login_required urlpatterns = [ path('', HomeView.as_view(), name='photos_home'), path('photos/<int:pk>', PhotoDetailView.as_view(), name='photos_detail'), path('photos/new/', CreateView.as_view(), name='create_photo'), path('photos/', PhotoListView.as_view(), name='photos_list'), path('my-photos/', login_required(UserPhotosView.as_view()), name='user_photos'), ]
from django.conf.urls import url from django.contrib import admin from django.contrib.auth.decorators import login_required from photos.views import HomeView, PhotoListView, UserPhotosView from users.api import UserListAPI, UserDetailAPI from users.views import LoginView from users.views import LogoutView from photos.views import DetailView from photos.views import CreateView 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'), # Users URLS url(r'^login$', LoginView.as_view() , name='users_login'), url(r'^logout$', LogoutView.as_view() , name='users_logout'), #Users API url(r'^api/1.0/users/$', UserListAPI.as_view(), name = 'user_list_api'), url(r'^api/1.0/users/(?P<pk>[0-9]+)$', UserDetailAPI.as_view(), name = 'user_detail_api') ]
from django.conf.urls import url from django.contrib import admin from users import views as users_views from photos import views as photos_views from photos.views import HomeView,DetailView,CreateView,ListView from users.views import LoginView,LogoutView urlpatterns = [ #Photos url(r'^admin/', admin.site.urls), url(r'^$',HomeView.as_view(),name='home'), url(r'^photos/new',CreateView.as_view(),name="create_photo"), url(r'^photo/(?P<pk>[0-9]+)$',DetailView.as_view(),name='photo_detail'), url(r'^photos/$',ListView.as_view(),name="photos_list"), # Users url(r'^login$', LoginView.as_view(), name='user_login'), url(r'^logout$', LogoutView.as_view(), name='user_logout') ]