Merge pull request #322 from eReuse/drop-imei-form
commit validation imei for mobiles
This commit is contained in:
commit
0c52598820
|
@ -1076,13 +1076,13 @@ class Mobile(Device):
|
||||||
|
|
||||||
@validates('imei')
|
@validates('imei')
|
||||||
def validate_imei(self, _, value: int):
|
def validate_imei(self, _, value: int):
|
||||||
if not imei.is_valid(str(value)):
|
if value and not imei.is_valid(str(value)):
|
||||||
raise ValidationError('{} is not a valid imei.'.format(value))
|
raise ValidationError('{} is not a valid imei.'.format(value))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@validates('meid')
|
@validates('meid')
|
||||||
def validate_meid(self, _, value: str):
|
def validate_meid(self, _, value: str):
|
||||||
if not meid.is_valid(value):
|
if value and not meid.is_valid(value):
|
||||||
raise ValidationError('{} is not a valid meid.'.format(value))
|
raise ValidationError('{} is not a valid meid.'.format(value))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
Reference in New Issue