from django.conf.urls import url from usuario.views import RegistroUsuario urlpatterns = [ url(r'^registrar',RegistroUsuario.as_view(), name="registrar") ]
from django.urls import path from usuario.views import RegistroUsuario, UserAPI app_name = 'App' urlpatterns = [ path('registrar', RegistroUsuario.as_view(), name="registrar"), path('api', UserAPI.as_view(), name="api"), ]
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 app.views import Inicio, ProductoPagina from usuario.views import RegistroUsuario from usuario.views import Login, logoutUsuario from django.contrib.auth.decorators import login_required from app import views from django.contrib.auth.models import User urlpatterns = [ path('admin/', admin.site.urls), path('app/', include(('app.urls', 'app'))), path('usuario/', include(('usuario.urls', 'usuario'))), path('', Inicio.as_view(), name='index'), path('registrar/', RegistroUsuario.as_view(), name='registrar'), path('accounts/login/', Login.as_view(), name='login'), path('logout/', login_required(logoutUsuario), name='logout'), path('buscar/', views.buscar), path('paginaventa/', ProductoPagina.as_view(), name='paginaventa'), ]
from django.contrib import admin from django.urls import path from usuario import views from usuario.views import RegistroUsuario urlpatterns = [ path('register', RegistroUsuario.as_view(), name="Register"), ]
from django.conf.urls import url, include from django.contrib.auth.decorators import login_required from usuario.views import privado,ingresar,cerrar from django.contrib import admin from django.contrib.auth.views import login from usuario.views import RegistroUsuario,ListarUsuario, change_password,Planes_externosEstablecimientoList,\ PlanesExternoEscuelaListView urlpatterns = [ url(r'^privado/$',privado, name='privado'), url(r'^ingresar/$',ingresar, name='ingresar'), url(r'^cerrar/$', cerrar, name='cerrar'), #url(r'^user/(?P<pk>\d+)/$', UserView.as_view(),name='main_user'), #url(r'^entrar$', Login.as_view(), name="login"), url(r'^registrar', login_required(RegistroUsuario.as_view()), name="registrar"), url(r'^Listar_usuario', login_required(ListarUsuario.as_view()), name="usuario_listar"), url(r'^login', login, {'template_name':'index.html'}, name='login'), url(r'^password/$', change_password, name='change_password'), url(r'^Planes_externosEstablecimientoList/$',login_required(Planes_externosEstablecimientoList), name="Planes_externosEstablecimientoList"), # Ver lostado de planes externos url(r'^PlanesExternoEscuelaListView/(?P<pk>\d+)/$',login_required(PlanesExternoEscuelaListView), name='PlanesExternoEscuelaListView'), ]
from django.conf.urls import url from usuario.views import RegistroUsuario urlpatterns = [ url(r'', RegistroUsuario.as_view(), name="register"), ]
from django.urls import path from usuario.views import RegistroUsuario from django.contrib.auth.decorators import login_required app_name ='usuario' urlpatterns = [ path('registrar', login_required(RegistroUsuario.as_view()), name='registrar') ]
from django.conf.urls import url from usuario.views import RegistroUsuario urlpatterns = [ url(r'^registrar/$', RegistroUsuario.as_view(), name='registrar') ]