forked from CGM_Public/pretix_original
Sendmail form: Fix validation problems
This commit is contained in:
@@ -68,7 +68,7 @@ class MailForm(forms.Form):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
d = super().clean()
|
d = super().clean()
|
||||||
if d.get('subevent') and d.get('subevents_from'):
|
if d.get('subevent') and (d.get('subevents_from') or d.get('subevents_to')):
|
||||||
raise ValidationError(pgettext_lazy('subevent', 'Please either select a specific date or a date range, not both.'))
|
raise ValidationError(pgettext_lazy('subevent', 'Please either select a specific date or a date range, not both.'))
|
||||||
if bool(d.get('subevents_from')) != bool(d.get('subevents_to')):
|
if bool(d.get('subevents_from')) != bool(d.get('subevents_to')):
|
||||||
raise ValidationError(pgettext_lazy('subevent', 'If you set a date range, please set both a start and an end.'))
|
raise ValidationError(pgettext_lazy('subevent', 'If you set a date range, please set both a start and an end.'))
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
{% block inner %}
|
{% block inner %}
|
||||||
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
|
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
{% bootstrap_form_errors form %}
|
||||||
{% bootstrap_field form.recipients layout='horizontal' %}
|
{% bootstrap_field form.recipients layout='horizontal' %}
|
||||||
{% bootstrap_field form.sendto layout='horizontal' %}
|
{% bootstrap_field form.sendto layout='horizontal' %}
|
||||||
{% if form.subevent %}
|
{% if form.subevent %}
|
||||||
|
|||||||
Reference in New Issue
Block a user