Allow to configure help text of email field

This commit is contained in:
Raphael Michel
2019-11-28 11:11:55 +01:00
parent a10082a46f
commit bb3348022f
4 changed files with 15 additions and 2 deletions

View File

@@ -672,6 +672,13 @@ Your {event} team"""))
'default': '',
'type': LazyI18nString
},
'checkout_email_helptext': {
'default': LazyI18nString.from_gettext(ugettext_noop(
'Make sure to enter a valid email address. We will send you an order '
'confirmation including a link that you need to access your order later.'
)),
'type': LazyI18nString
},
'organizer_info_text': {
'default': '',
'type': LazyI18nString

View File

@@ -502,6 +502,12 @@ class EventSettingsForm(SettingsForm):
required=False,
widget=I18nTextarea
)
checkout_email_helptext = I18nFormField(
label=_("Help text of the email field"),
required=False,
widget_kwargs={'attrs': {'rows': '2'}},
widget=I18nTextarea
)
presale_has_ended_text = I18nFormField(
label=_("End of presale text"),
required=False,

View File

@@ -92,6 +92,7 @@
{% bootstrap_field sform.presale_has_ended_text layout="control" %}
{% bootstrap_field sform.voucher_explanation_text layout="control" %}
{% bootstrap_field sform.confirm_text layout="control" %}
{% bootstrap_field sform.checkout_email_helptext layout="control" %}
</fieldset>
<fieldset>
<legend>{% trans "Shop design" %}</legend>

View File

@@ -26,8 +26,6 @@ from pretix.presale.signals import contact_form_fields
class ContactForm(forms.Form):
required_css_class = 'required'
email = forms.EmailField(label=_('E-mail'),
help_text=_('Make sure to enter a valid email address. We will send you an order '
'confirmation including a link that you need to access your order later.'),
validators=[EmailBanlistValidator()],
widget=forms.EmailInput(attrs={'autocomplete': 'section-contact email'})
)
@@ -49,6 +47,7 @@ class ContactForm(forms.Form):
# is an autofocus field. Who would have thought… See e.g. here:
# https://floatboxjs.com/forum/topic.php?post=8440&usebb_sid=2e116486a9ec6b7070e045aea8cded5b#post8440
self.fields['email'].widget.attrs['autofocus'] = 'autofocus'
self.fields['email'].help_text = self.event.settings.checkout_email_helptext
responses = contact_form_fields.send(self.event, request=self.request)
for r, response in responses: