Skip to content

Commit

Permalink
Added coderrabit suggestions
Browse files Browse the repository at this point in the history
- Ensuring no empty space
  • Loading branch information
areebahmeddd committed Nov 19, 2024
1 parent 46c9e39 commit e0c8351
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions care/facility/api/serializers/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def validate_year_of_birth(self, value):
def validate_name(self, value):
if value is None:
raise serializers.ValidationError("Patient name is required.")
if not value.strip():
raise serializers.ValidationError("Patient name cannot be empty.")
if any(char.isdigit() for char in value):
raise serializers.ValidationError("Patient name cannot contain numeric values.")
return value
Expand Down

0 comments on commit e0c8351

Please sign in to comment.