created json field Company.credentials, added import_products action to CompanyViewSet
This commit is contained in:
@@ -35,8 +35,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
||||
Send email to company.creator
|
||||
"""
|
||||
try:
|
||||
queryset = self.get_custom_queryset(request)
|
||||
instance = queryset.filter(pk=kwargs['pk']).first()
|
||||
instance = self.queryset.filter(pk=kwargs['pk']).first()
|
||||
if instance:
|
||||
# IP stuff
|
||||
client_ip, is_routable = get_client_ip(request)
|
||||
@@ -121,6 +120,20 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
||||
except Exception as e:
|
||||
return Response({"errors":{"details": str(e),}}, status=500)
|
||||
|
||||
@action(detail=True, methods=['POST', ])
|
||||
def import_products(self, request, **kwargs):
|
||||
instance = self.queryset.filter(pk=kwargs['pk']).first()
|
||||
# check if it's a shop
|
||||
if instance.shop is not True:
|
||||
return Response('This company is not s shop')
|
||||
# check what platform
|
||||
platform = instance.platform
|
||||
# check required credentials
|
||||
|
||||
# execute import
|
||||
|
||||
return Response()
|
||||
|
||||
|
||||
@api_view(['GET',])
|
||||
@permission_classes([IsAuthenticated,])
|
||||
|
||||
Reference in New Issue
Block a user