base of product-quota & list cities by province
This commit is contained in:
@@ -21,6 +21,42 @@ def delete(queryset, pk):
|
||||
obj.delete()
|
||||
|
||||
|
||||
class ProductCategoryViewSet(viewsets.ModelViewSet):
|
||||
queryset = product_models.ProductCategory.objects.all()
|
||||
serializer_class = product_serializers.ProductCategorySerializer
|
||||
|
||||
@action(
|
||||
methods=['put'],
|
||||
detail=True,
|
||||
url_path='trash',
|
||||
url_name='trash',
|
||||
name='trash',
|
||||
)
|
||||
@transaction.atomic
|
||||
def trash(self, request, pk=None):
|
||||
""" Sent product to trash """
|
||||
try:
|
||||
trash(self.queryset, pk)
|
||||
except APIException as e:
|
||||
return Response(e, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
@action(
|
||||
methods=['post'],
|
||||
detail=True,
|
||||
url_name='delete',
|
||||
url_path='delete',
|
||||
name='delete'
|
||||
)
|
||||
@transaction.atomic
|
||||
def delete(self, request, pk=None):
|
||||
""" Full delete of product object """
|
||||
try:
|
||||
delete(self.queryset, pk)
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
except APIException as e:
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class ProductViewSet(viewsets.ModelViewSet):
|
||||
queryset = product_models.Product.objects.all()
|
||||
serializer_class = product_serializers.ProductSerializer
|
||||
@@ -209,7 +245,7 @@ class SaleUnitViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class IncentivePlanViewSet(viewsets.ModelViewSet):
|
||||
class IncentivePlanViewSet(viewsets.ModelViewSet): # noqa
|
||||
""" apis for incentive plan """
|
||||
|
||||
queryset = product_models.IncentivePlan.objects.all()
|
||||
|
||||
Reference in New Issue
Block a user