Example #1
0
    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)
Example #2
0
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'),
]
Example #3
0
from django.urls import path
from items import views
from api.views import ItemListView, ItemDetailView
from django.conf import settings
from django.conf.urls.static import static
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

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('api/items/', ItemListView.as_view(), name='api-list'),
    path('api/items/<int:item_id>/',
         ItemDetailView.as_view(),
         name='api-detail'),
    # path('api/login/', UserLoginAPIView.as_view(), name='api-login'),
    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/token/', TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    path('api/token/refresh/',
         TokenRefreshView.as_view(),
         name='token_refresh'),
Example #4
0
from django.contrib import admin
from django.urls import path, re_path
from api.views import UserView, ItemListView, ItemView, ResultListView, ResultView
from m.views import RenderHtmlView
from dw.views import RenderDwView
from werobot.contrib.django import make_view
from mx.reply import robot

app_name = 'm'
urlpatterns = [
    path('admin/', admin.site.urls),
    re_path(r'^api/user/', UserView.as_view(), name='user'),
    re_path(r'^api/item/', ItemView.as_view(), name='item'),
    re_path(r'^api/itemlist/', ItemListView.as_view(), name='itemlist'),
    re_path(r'^api/resultlist/', ResultListView.as_view(), name='resultlist'),
    re_path(r'^api/result/', ResultView.as_view(), name='result'),
    re_path(r'^$', make_view(robot), name='robot'),
    re_path(r'^m/(?P<html>.+)/', RenderHtmlView.as_view(), name='m'),
    re_path(r'^dw/(?P<random_str>.+)/', RenderDwView.as_view(), name='dw')
]
Example #5
0
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()),
]
Example #6
0
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
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

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('item/list/view/', ItemListView.as_view(), name='item-list-view'),
    path('item/list/detail/<int:item_id>/',
         ItemDetailView.as_view(),
         name='item-detail-view'),
    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('login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Example #7
0
from api.views import ItemDetailView, ItemListView, Register
from items import views
from django.conf import settings
from django.conf.urls.static import static
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

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('login/', TokenObtainPairView.as_view(), name="api-login"),
    #    path('token/refresh/', TokenRefreshView.as_view(), name="token-refresh"),
    path('register/', Register.as_view(), name="api-register"),
    path('items/listapi/', ItemListView.as_view(), name="api-list"),
    path('items/detailapi/<int:item_id>',
         ItemDetailView.as_view(),
         name="api-detail"),
]

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