Moves product stat view logic to serializer
- Split frontend into multiple files - Bump frontend deps - Remove unused stuff
This commit is contained in:
1 parent
3b7980ffe9
commit
195c49b0fd
24 files changed
+555
-599
No files matched your search
+12
-3
@@ -1,9 +1,18 @@
|
||||
from main.api.serializers import ProductSerializer
|
||||
from main.models import Product
|
||||
from rest_framework.decorators import list_route
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
|
||||
from main.api.serializers import ProductSerializer, ProductStatSerializer
|
||||
from main.models import Product
|
||||
|
||||
|
||||
class ProductViewSet(ModelViewSet):
|
||||
# TODO: auth
|
||||
serializer_class = ProductSerializer
|
||||
queryset = Product.objects.all()
|
||||
|
||||
@list_route(methods=['get'])
|
||||
def group_by_user(self, request):
|
||||
products = self.get_queryset().filter(active=True)
|
||||
serializer = ProductStatSerializer(products, many=True)
|
||||
|
||||
return Response(serializer.data)
|
||||
Reference in new issue
Block a user