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') @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

View file

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