Added back collections method for collection detail
This commit is contained in:
parent
0b1b960108
commit
6cbfc38c9c
|
|
@ -1,4 +1,5 @@
|
||||||
"""Collection common urlpaths."""
|
"""Collection common urlpaths."""
|
||||||
|
from django.urls import path
|
||||||
from rest_framework.routers import SimpleRouter
|
from rest_framework.routers import SimpleRouter
|
||||||
|
|
||||||
from collection.views import back as views
|
from collection.views import back as views
|
||||||
|
|
@ -7,4 +8,9 @@ app_name = 'collection'
|
||||||
router = SimpleRouter()
|
router = SimpleRouter()
|
||||||
router.register(r'', views.CollectionBackOfficeViewSet)
|
router.register(r'', views.CollectionBackOfficeViewSet)
|
||||||
|
|
||||||
urlpatterns = router.urls
|
urlpatterns = [
|
||||||
|
path('/<int:pk>/', views.CollectionBackOfficeView.as_view(), name='detail'),
|
||||||
|
]
|
||||||
|
|
||||||
|
urlpatterns += router.urls
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from rest_framework import generics
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
from rest_framework import viewsets, mixins
|
from rest_framework import viewsets, mixins
|
||||||
|
|
||||||
|
|
@ -47,3 +48,12 @@ class CollectionBackOfficeViewSet(mixins.CreateModelMixin,
|
||||||
collection.establishments.remove(related_object)
|
collection.establishments.remove(related_object)
|
||||||
elif obj_type == self.bind_object_serializer_class.PRODUCT:
|
elif obj_type == self.bind_object_serializer_class.PRODUCT:
|
||||||
collection.products.remove(related_object)
|
collection.products.remove(related_object)
|
||||||
|
|
||||||
|
|
||||||
|
class CollectionBackOfficeView(generics.GenericAPIView):
|
||||||
|
"""ViewS for Collection model."""
|
||||||
|
|
||||||
|
pagination_class = None
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
queryset = models.Collection.objects.all()
|
||||||
|
serializer_class = serializers.CollectionBackOfficeSerializer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user