0001-misc-use-HTML5-type-tel-for-phone-number-input-field.patch
src/authentic2/attribute_kinds.py | ||
---|---|---|
113 | 113 | |
114 | 114 | |
115 | 115 |
class PhoneNumberField(forms.CharField): |
116 |
widget = widgets.PhoneNumberInput |
|
117 | ||
116 | 118 |
def __init__(self, *args, **kwargs): |
117 | 119 |
kwargs['max_length'] = 30 |
118 | 120 |
kwargs.setdefault('help_text', _('ex.: 0699999999, +33 6 99 99 99 99')) |
src/authentic2/forms/widgets.py | ||
---|---|---|
300 | 300 |
datalist += '</datalist>' |
301 | 301 |
output += datalist |
302 | 302 |
return output |
303 | ||
304 | ||
305 |
class PhoneNumberInput(TextInput): |
|
306 |
input_type = 'tel' |
tests/test_profile.py | ||
---|---|---|
41 | 41 | |
42 | 42 |
resp = old_resp = app.get(url, status=200) |
43 | 43 |
resp.form['edit-profile-phone'] = '1234' |
44 |
assert resp.form['edit-profile-phone'].attrs['type'] == 'tel' |
|
44 | 45 |
resp.form['edit-profile-title'] = 'Mrs' |
45 | 46 |
resp.form['edit-profile-agreement'] = False |
46 | 47 |
resp = resp.form.submit() |
47 |
- |