Esempio n. 1
0
from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token

from api.views import category_list, products_list, UserAPIView, product_detail, categoryproducts, OrdersListAPIView

urlpatterns = [
     path('login/', obtain_jwt_token),


     path('categories/', category_list),
     path('categories/<int:category_id>/products', categoryproducts),



     path('products/', products_list),
     path('products/<int:product_id>/', product_detail),


     path('users/', UserAPIView.as_view()),

     path('orders/', OrdersListAPIView.as_view()),
     path('orders/', OrdersListAPIView.as_view()),

     # path('login/', LoginView.as_view()),
     # path('logout/', LogoutView.as_view()),
]
Esempio n. 2
0
from django.urls import path

from api.views import UserAPIView, UserDetailView, ImageAPIView, ImageDetailView

urlpatterns = [
    path("users/", UserAPIView.as_view(), name="user_list"),
    path("users/<int:pk>/", UserDetailView.as_view(), name="user_detail"),
    path("images/", ImageAPIView.as_view(), name="image_list"),
    path("images/<int:pk>/", ImageDetailView.as_view(), name="image_detail"),
]
Esempio n. 3
0
from django.contrib import admin
from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token
from api.views import (IndexAPIView, UserSignInAPIView, UserSignUpAPIView,
                       AlbumCreateAPIView, AlbumListAPIView,
                       AlbumRetrieveAPIView, ImageCreateAPIView,
                       ImageRetrieveAPIView, UserAPIView)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', IndexAPIView.as_view(), name='index'),
    url(r'^signup/$', UserSignUpAPIView.as_view(), name='signup'),
    url(r'^signin/$', UserSignInAPIView.as_view(), name='signin'),
    url(r'^api/getCurrUser$', UserAPIView.as_view(), name='getCurrUser$'),
    url(r'^api/album/create/$',
        AlbumCreateAPIView.as_view(),
        name='album_create'),
    url(r'^api/album/$', AlbumListAPIView.as_view(), name='album_list'),
    url(r'^api/album/(?P<pk>\d+)/$',
        AlbumRetrieveAPIView.as_view(),
        name='album_retrieve'),
    url(r'^api/image/create/$',
        ImageCreateAPIView.as_view(),
        name='image_create'),
    url(r'^api/image/(?P<pk>\d+)/$',
        ImageRetrieveAPIView.as_view(),
        name='image_retrieve'),
    # url(r'^api/', include(router.urls), name='list_album'),
    url(r'^api-auth/',
Esempio n. 4
0
from rest_framework import routers
from api.views import UserAPIView, UserDetail, UserViewSet, RoomAPIView, RoomDetail, RoomViewSet, FavoritesDetail, Search

# Api
from api.views import UserViewSet
"""
DefaultRouter will define the standard REST
GET, POST, PUT, DELETE...
"""
router = routers.DefaultRouter()
router.register(r'user', UserViewSet, basename='user')
router.register(r'room', RoomViewSet, basename='room')

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^auth/', include('rest_auth.urls')),
    url('viewset/', include(router.urls)),
    url('user/', UserAPIView.as_view()),
    url('room/', RoomAPIView.as_view()),

    # UserDetail shows user detail
    url('user_detail/<int:id>/', UserDetail.as_view()),
    url('room_detail/<int:id>/', RoomDetail.as_view()),

    # Favorites
    url('favorites/<int:id_user>,<int:id_room>/', FavoritesDetail.as_view()),
    url('favorites/<int:id>/', FavoritesDetail.as_view()),

    # Search
    url('search/<str:location>/', Search.as_view()),
]