Skip to content

Commit

Permalink
Fixes issue with serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshhari committed Nov 27, 2022
1 parent 850cf56 commit 0e4ac0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions care/users/api/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def validate_ward(self, value):
and value != self.context["created_by"].ward
and not self.context["created_by"].is_superuser
and not self.context["created_by"].user_type
>= User.TYPE_VALUE_MAP["LocalBodyAdmin"]
>= User.TYPE_VALUE_MAP["LocalBodyAdmin"]
):
raise serializers.ValidationError("Cannot create for a different Ward")
return value
Expand All @@ -110,7 +110,7 @@ def validate_local_body(self, value):
and value != self.context["created_by"].local_body
and not self.context["created_by"].is_superuser
and not self.context["created_by"].user_type
>= User.TYPE_VALUE_MAP["DistrictAdmin"]
>= User.TYPE_VALUE_MAP["DistrictAdmin"]
):
raise serializers.ValidationError(
"Cannot create for a different local body"
Expand All @@ -123,7 +123,7 @@ def validate_district(self, value):
and value != self.context["created_by"].district
and not self.context["created_by"].is_superuser
and not self.context["created_by"].user_type
>= User.TYPE_VALUE_MAP["StateAdmin"]
>= User.TYPE_VALUE_MAP["StateAdmin"]
):
raise serializers.ValidationError("Cannot create for a different district")
return value
Expand Down Expand Up @@ -296,7 +296,7 @@ def validate(self, attrs):

class UserBaseMinimumSerializer(serializers.ModelSerializer):
user_type = ChoiceField(choices=User.TYPE_CHOICES, read_only=True)
home_facility = FacilityBareMinimumSerializer(source="home_facility", read_only=True)
home_facility = FacilityBareMinimumSerializer(read_only=True)

class Meta:
model = User
Expand Down

0 comments on commit 0e4ac0f

Please sign in to comment.