name='restaurant-delete'), path('restaurants/<int:restaurant_id>/favorite/', views.restaurant_favorite, name='restaurant-favorite'), path('restaurants/<int:restaurant_id>/item/add/', views.item_create, name='item-create'), path('signup/', views.signup, name='signup'), path('signin/', views.signin, name='signin'), path('signout/', views.signout, name='signout'), path('no-access/', views.no_access, name='no-access'), path('api/list/', RestaurantListView.as_view(), name='api-list'), path('api/create/', RestaurantCreateView.as_view(), name='api-create'), path('api/<int:restaurant_id>/detail/', RestaurantDetailView.as_view(), name='api-detail'), path('api/<int:restaurant_id>/update/', RestaurantUpdateView.as_view(), name='api-update'), path('api/<int:restaurant_id>/delete/', RestaurantDeleteView.as_view(), name='api-delete'), path('api/register/', RegisterView.as_view(), name='api-register'), path('api/login/', obtain_jwt_token, name='api-login'), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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 from django.contrib import admin from django.urls import include, path from api.views import RegisterView from rest_framework_jwt.views import obtain_jwt_token urlpatterns = [ url(r'^admin/', admin.site.urls), path('api/', include('api.urls')), path('api-auth/', include('rest_framework.urls')), path('lot-owners/', include('lotOwners.urls')), path('university/', include('university.urls')), path('attendant/', include('attendant.urls')), path('api-auth/register/', RegisterView.as_view()), path('token-auth/', obtain_jwt_token), ]
from django.urls import path, include from rest_framework.routers import DefaultRouter from api.views import ProductViewSet, ReviewViewSet, OrderViewSet, CollectionViewSet, FavoritesViewSet, RegisterView router = DefaultRouter() router.register('products', ProductViewSet, 'products') router.register('product-reviews', ReviewViewSet, 'product-reviews') router.register('orders', OrderViewSet, 'orders') router.register('collections', CollectionViewSet, 'product-collections') router.register('favorites', FavoritesViewSet, 'favorites') urlpatterns = [ path('', include(router.urls)), path('register/', RegisterView.as_view(), name='register') ]
from django.urls import re_path from django.conf.urls import include from rest_framework import routers from rest_framework.authtoken import views from api.views import UserViewSet from api.views import RegisterView from api.views import ShopViewSet from api.views import CheckOpenView # Routers provide an easy way of automatically determining the URL conf. router = routers.DefaultRouter() router.register(r'user', UserViewSet) router.register(r'shop', ShopViewSet) urlpatterns = [ re_path(r'^api-token-auth/', views.obtain_auth_token), re_path(r'^', include(router.urls), name='api'), re_path(r'^register/', RegisterView.as_view(), name='api-register'), re_path(r'^check-open/', CheckOpenView.as_view(), name='api-check-open'), ]
from django.contrib import admin from django.urls import path, include from api.views import RegisterView, ItemListView, UserEdit urlpatterns = [ path('register/', RegisterView.as_view()), path('items/', ItemListView.as_view()), path('user/update/<int:pk>/', UserEdit.as_view()), ]
from django.conf.urls import url from django.urls import include from rest_framework import routers from api import views from api.views import LoginView, RegisterView, QuestionViewSet route = routers.DefaultRouter() # 注册新的路由地址 route.register(r'question', views.QuestionViewSet) route.register(r'answer', views.AnswerViewSet) urlpatterns = [ url(r'^login/$', LoginView.as_view()), url(r'^register/$', RegisterView.as_view()), url(r'^answerset/(?P<pk>.+)/$', views.AnswerSetViewSet.as_view()), url('', include(route.urls)), ]
""" URL patterns for farmhands API """ from django.conf.urls import url from api.views import PlanView, PlanDetailView, UserPlanView,\ UserPlanDetailView, LoginView, RegisterView, LogoutView urlpatterns = [ url(r'^plans$', PlanView.as_view(), name='plans'), url(r'^plans/(?P<planid>[0-9]+)$', PlanDetailView.as_view(), name='plan'), url(r'^users/(?P<userid>[0-9]+)/plans$', UserPlanView.as_view(), name='userplans'), url(r'^users/(?P<userid>[0-9]+)/plans/(?P<planid>[0-9]+)$', UserPlanDetailView.as_view(), name='userplan'), url(r'^login$', LoginView.as_view(), name='login'), url(r'^logout$', LogoutView.as_view(), name='logout'), url(r'^register$', RegisterView.as_view(), name='register') ]
from django.urls import path, include from rest_framework import routers from api.views import ProjectsViewSet, IssueViewSet, LogoutView, RegisterView from rest_framework.authtoken.views import obtain_auth_token router = routers.DefaultRouter() router.register(r'issues', IssueViewSet) router.register(r'projects', ProjectsViewSet) app_name = 'api' urlpatterns = [ path('', include(router.urls)), path('login/', obtain_auth_token, name='api_token_auth'), path('logout/', LogoutView.as_view(), name='delete_auth_token'), path('register/', RegisterView.as_view(), name='login_user') ]