Django_rest_api/backend/drf_course/urls.py
devfzn 0cfc0e5991
creación de vistas genericas para app ecommerce
Se utilizan viewsets del framework.
registro de vistas genericas en router del urls.py del sitio.
2023-03-30 15:49:52 -03:00

19 lines
612 B
Python

from django.contrib import admin
from django.urls import path
from core import views as core_views
from ecommerce import views as ecommerce_views
from rest_framework import routers
from rest_framework.authtoken.views import obtain_auth_token
router = routers.DefaultRouter()
router.register(r'item', ecommerce_views.ItemViewSet, basename='item')
router.register(r'order', ecommerce_views.OrderViewSet, basename='order')
urlpatterns = router.urls
urlpatterns += [
path('admin/', admin.site.urls),
path('contact/', core_views.ContactAPIView.as_view()),
path('api-token-auth/', obtain_auth_token),
]