edit assignment
This commit is contained in:
@@ -13,7 +13,7 @@ class POSClientSerializer(ModelSerializer):
|
||||
org = attrs['organization']
|
||||
|
||||
# check for duplicate organization client
|
||||
if org:
|
||||
if not self.instance and org:
|
||||
if self.Meta.model.objects.filter(organization=org).exists():
|
||||
raise APIException("قبلا کلاینت با این سازمان ثبت شده است", code=status.HTTP_403_FORBIDDEN) # noqa
|
||||
|
||||
|
||||
@@ -56,8 +56,9 @@ class DeviceAssignmentSerializer(ModelSerializer):
|
||||
device = attrs['device']
|
||||
client = attrs['client']
|
||||
|
||||
if self.Meta.model.objects.filter(device=device, client=client).exists():
|
||||
raise pos_exceptions.DeviceAlreadyAssigned()
|
||||
if not self.instance:
|
||||
if self.Meta.model.objects.filter(device=device, client=client).exists():
|
||||
raise pos_exceptions.DeviceAlreadyAssigned()
|
||||
|
||||
return attrs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user