drop required of imei and meid

This commit is contained in:
Cayo Puigdefabregas 2022-07-28 18:34:34 +02:00
parent b0beff5b1d
commit 637308ee8f
2 changed files with 3 additions and 4 deletions

View File

@ -1076,13 +1076,13 @@ class Mobile(Device):
@validates('imei')
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))
return value
@validates('meid')
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))
return value

View File

@ -291,8 +291,7 @@ class Mobile(Device):
@pre_load
def convert_check_imei(self, data):
if data.get('imei', None):
# data['imei'] = int(imei.validate(data['imei']))
data['imei'] = int(data['imei'])
data['imei'] = int(imei.validate(data['imei']))
return data
@pre_load