0.8.38 change profile validation
This commit is contained in:
@@ -23,6 +23,18 @@ class RouteForm(forms.ModelForm):
|
||||
|
||||
|
||||
try:
|
||||
if 'phone' in cleaned_data and 'phone' in cleaned_data:
|
||||
from BaseModels.validators.form_field_validators import get_phone_valid_error
|
||||
error = get_phone_valid_error(cleaned_data["phone"])
|
||||
if error:
|
||||
self.add_error('phone', error)
|
||||
|
||||
if 'extra_phone' in cleaned_data and 'extra_phone' in cleaned_data:
|
||||
from BaseModels.validators.form_field_validators import get_phone_valid_error
|
||||
error = get_phone_valid_error(cleaned_data["extra_phone"])
|
||||
if error:
|
||||
self.add_error('extra_phone', error)
|
||||
|
||||
if 'departure_DT' in cleaned_data and 'arrival_DT' in cleaned_data and cleaned_data['arrival_DT'] < cleaned_data['departure_DT']:
|
||||
self.add_error('arrival_DT', _('Указана неверная дата прибытия'))
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ 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})
|
||||
|
||||
Dict = {
|
||||
'form': form,
|
||||
'errors_off': errors_off
|
||||
|
||||
Reference in New Issue
Block a user