Add question type: phone number (#1462)

* Add Phonenumber-Field as to Questions

* Add setup requirements

* Add list of ask-during-checkin restricted question types and enforce it

* Fix requirements

* Fix crash using custom locales

* Re-format phone numbers when outputting to humans

* Initialize country code field with a guess for the customer's country

* Document TEL type in API docs
This commit is contained in:
Martin Gross
2019-11-13 12:52:07 +01:00
committed by Raphael Michel
parent 06a744ea2d
commit 54091b9721
10 changed files with 83 additions and 17 deletions

View File

@@ -77,6 +77,14 @@ class QuestionForm(I18nModelForm):
dep = dep.dependency_question
return val
def clean_ask_during_checkin(self):
val = self.cleaned_data.get('ask_during_checkin')
if val and self.cleaned_data.get('type') in Question.ASK_DURING_CHECKIN_UNSUPPORTED:
raise ValidationError(_('This type of question cannot be asked during check-in.'))
return val
def clean(self):
d = super().clean()
if d.get('dependency_question') and not d.get('dependency_values'):