diff --git a/BaseModels/validators/form_field_validators.py b/BaseModels/validators/form_field_validators.py index a90595b..9e7279b 100644 --- a/BaseModels/validators/form_field_validators.py +++ b/BaseModels/validators/form_field_validators.py @@ -4,6 +4,9 @@ def get_phone_valid_error(val): error_msg = _('Некорректные символы в номере телефона,
пример корректного ввода +7 925 8600100') + if not val: + return None + if len(val) < 10: return error_msg diff --git a/RoutesApp/funcs.py b/RoutesApp/funcs.py index 1c50840..22e269c 100644 --- a/RoutesApp/funcs.py +++ b/RoutesApp/funcs.py @@ -78,8 +78,8 @@ def get_profile_new_route_page_html(request, data): if 'owner_type' in data: form.initial['owner_type'] = data['owner_type'] - if request.user and request.user.is_authenticated and request.user.profile and request.user.profile.phone: - form.initial.update({'phone': request.user.profile.phone}) + if request.user and request.user.is_authenticated and request.user.user_profile and request.user.user_profile.phone: + form.initial.update({'phone': request.user.user_profile.phone}) Dict = { 'form': form,