def update(self, request, pk=None): queryset = CompanyAccount.objects.all() companyaccount = get_object_or_404(queryset, pk=pk) serializer = CompanyAccountSerializer(companyaccount, data=request.data, context={"request": request}) serializer.is_valid(raise_exception=True) serializer.save() return Response({"error": False, "message": "Data has been upddated"})
def create(self,request): try: serializer=CompanyAccountSerializer(data=request.data,context={"request":request}) serializer.is_valid(raise_exception=True) serializer.save() dict_response={"error":False,"message":"Company Account Data Save Successfully"} except: dict_response={"error":True,"message":"Error During Saving Company Account Data"} return Response(dict_response)
def create(self, request): try: serializer = CompanyAccountSerializer(data=request.data, context={"request": request}) serializer.is_valid(raise_exception=True) serializer.save() response_dict = { "error": False, "message": "Company account data save successfully" } except: response_dict = { "error": True, "message": "Error during saving company account data" } return Response(response_dict)