Added nullable
This commit is contained in:
parent
b4cdb2dc5b
commit
65ace7fb88
|
|
@ -185,12 +185,16 @@ class AddressBaseSerializer(serializers.ModelSerializer):
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate_latitude(self, value):
|
def validate_latitude(self, value):
|
||||||
if -90 <= value <= 90:
|
if value is None:
|
||||||
|
return
|
||||||
|
elif -90 <= value <= 90:
|
||||||
return value
|
return value
|
||||||
raise serializers.ValidationError(_('Invalid value'))
|
raise serializers.ValidationError(_('Invalid value'))
|
||||||
|
|
||||||
def validate_longitude(self, value):
|
def validate_longitude(self, value):
|
||||||
if -180 <= value <= 180:
|
if value is None:
|
||||||
|
return
|
||||||
|
elif -180 <= value <= 180:
|
||||||
return value
|
return value
|
||||||
raise serializers.ValidationError(_('Invalid value'))
|
raise serializers.ValidationError(_('Invalid value'))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user