コード例 #1
0
ファイル: urls.py プロジェクト: zeinay/DBAPI3apr
from django.urls import path
from .views import UserCreateAPIView
from rest_framework_jwt.views import obtain_jwt_token
from api.views import (ItemListView, ItemDetailView, CartListView,
                       CartCreateAPIView, UserUpdateView, CartListView,
                       OrderUpdateView, ItemCreateAPIView, CartUpdateView,
                       OrderControlAPIView)

urlpatterns = [
    path('login/', obtain_jwt_token, name='login'),
    path('register/', UserCreateAPIView.as_view(), name='register'),
    path('userupdate/<int:user_id>',
         UserUpdateView.as_view(),
         name='userupdate'),
    path('list/', ItemListView.as_view(), name='api-list'),
    path('details/<int:item_id>', ItemDetailView.as_view(), name='api-detail'),
    path('update_order/<int:order_id>',
         OrderUpdateView.as_view(),
         name='api-updateorder'),
    path('cart/', CartListView.as_view(), name='api-cart'),
    path('addcart/', CartCreateAPIView.as_view(), name='api-addcart'),
    path('update_item/<int:item_id>',
         CartUpdateView.as_view(),
         name='api-updateitem'),
    path('additem/', ItemCreateAPIView.as_view(), name='api-additem'),
    path('ctrl_order/<int:item_id>',
         OrderControlAPIView.as_view(),
         name='api-ctrl-order'),
]
コード例 #2
0
ファイル: urls.py プロジェクト: aljumiah/wishlist-api
    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 items import views
from django.conf import settings
from django.conf.urls.static import static
from api.views import ItemListView, ItemDetailView

urlpatterns = [
    path('admin/', admin.site.urls),

    path('items/list/', views.item_list, name='item-list'),
    path('items/detail/<int:item_id>/', views.item_detail, name='item-detail'),
    path('items/wishlist/', views.wishlist, name='wishlist' ),

    path('user/register/', views.user_register, name='user-register'),
    path('user/login/', views.user_login, name='user-login'),
    path('user/logout/', views.user_logout, name='user-logout'),

    path('items/<int:item_id>/favorite/', views.item_favorite, name='item-favorite'),

    path('api/list/',ItemListView.as_view(), name='item-favorite'),
    path('api/<int:item_id>/detail/', ItemDetailView.as_view(), name='api-detail'),



]

urlpatterns+=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
コード例 #3
0
    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 items import views
from django.conf import settings
from django.conf.urls.static import static
from api.views import ItemListView, ItemDetailView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('items/list/', views.item_list, name='item-list'),
    path('items/detail/<int:item_id>/', views.item_detail, name='item-detail'),
    path('items/wishlist/', views.wishlist, name='wishlist'),
    path('user/register/', views.user_register, name='user-register'),
    path('user/login/', views.user_login, name='user-login'),
    path('user/logout/', views.user_logout, name='user-logout'),
    path('items/<int:item_id>/favorite/',
         views.item_favorite,
         name='item-favorite'),
    path('api/list/', ItemListView.as_view(), name='api-list'),
    path('api/<int:item_id>/detail/',
         ItemDetailView.as_view(),
         name='api-detail'),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
コード例 #4
0
ファイル: urls.py プロジェクト: nancyelsh/wishlist-api
    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 items import views
from django.conf import settings
from django.conf.urls.static import static
from api.views import ListAPIView

# from api import views as api_views
from api.views import ItemDetailView, ItemListView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('items/list/', views.item_list, name='item-list'),
    path('items/detail/<int:item_id>/', views.item_detail, name='item-detail'),
    path('items/wishlist/', views.wishlist, name='wishlist'),
    path('user/register/', views.user_register, name='user-register'),
    path('user/login/', views.user_login, name='user-login'),
    path('user/logout/', views.user_logout, name='user-logout'),
    path('list/', ItemListView.as_view(), name='list'),
    path('detail/<int:item_id>/', ItemDetailView.as_view(), name='detail'),
    path('items/<int:item_id>/favorite/',
         views.item_favorite,
         name='item-favorite'),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)