Skip to content

Commit

Permalink
rectified error message when validating district (#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pragati1610 authored and vigneshhari committed Sep 15, 2022
1 parent 87a55ca commit dce173b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions care/users/api/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def validate_district(self, value):
and not self.context["created_by"].user_type
>= User.TYPE_VALUE_MAP["StateAdmin"]
):
raise serializers.ValidationError("Cannot create for a different state")
raise serializers.ValidationError("Cannot create for a different district")
return value

def validate_state(self, value):
Expand All @@ -140,9 +140,7 @@ def validate_state(self, value):
def validate(self, attrs):
validated = super(UserCreateSerializer, self).validate(attrs)
if "home_facility" in validated:
allowed_facilities = get_home_facility_queryset(
self.context["created_by"]
)
allowed_facilities = get_home_facility_queryset(self.context["created_by"])
if not allowed_facilities.filter(id=validated["home_facility"].id).exists():
raise exceptions.ValidationError(
{
Expand Down

0 comments on commit dce173b

Please sign in to comment.