Add attendee email field (#466)

* Add attendee email field

* exports, tests
This commit is contained in:
Raphael Michel
2017-04-13 22:59:54 +02:00
committed by GitHub
parent 3c59a870e7
commit e4706dd3ba
16 changed files with 155 additions and 4 deletions

View File

@@ -240,6 +240,21 @@ class EventSettingsForm(SettingsForm):
help_text=_("Require customers to fill in the names of all attendees."),
required=False
)
attendee_emails_asked = forms.BooleanField(
label=_("Ask for attendee e-mails"),
help_text=_("Ask for an e-mail address for all tickets which include admission to the event. Important: For "
"every order, an e-mail address needs to be provided, regardless of this setting. The order "
"confirmation which can be used to change the order will always only be sent to the e-mail "
"address provided for the order. Only check this box if you want to ask for additional e-mail "
"addresses for each attendee, e.g. in case of group orders."),
required=False
)
attendee_emails_required = forms.BooleanField(
label=_("Require attendee e-mails"),
help_text=_("Require customers to fill in the e-mail addresses of all attendees. See the above option for "
"more details."),
required=False
)
max_items_per_order = forms.IntegerField(
min_value=1,
label=_("Maximum number of items per order")
@@ -274,6 +289,11 @@ class EventSettingsForm(SettingsForm):
raise ValidationError({
'attendee_names_required': _('You cannot require specifying attendee names if you do not ask for them.')
})
if data['attendee_emails_required'] and not data['attendee_emails_asked']:
raise ValidationError({
'attendee_emails_required': _('You cannot require specifying attendee emails if you do not ask for '
'them.')
})
return data

View File

@@ -41,6 +41,8 @@
{% bootstrap_field sform.max_items_per_order layout="horizontal" %}
{% bootstrap_field sform.attendee_names_asked layout="horizontal" %}
{% bootstrap_field sform.attendee_names_required layout="horizontal" %}
{% bootstrap_field sform.attendee_emails_asked layout="horizontal" %}
{% bootstrap_field sform.attendee_emails_required layout="horizontal" %}
{% bootstrap_field sform.cancel_allow_user layout="horizontal" %}
</fieldset>
<fieldset>

View File

@@ -187,6 +187,11 @@
<dd>{% if line.attendee_name %}{{ line.attendee_name }}{% else %}
<em>{% trans "not answered" %}</em>{% endif %}</dd>
{% endif %}
{% if line.item.admission and event.settings.attendee_emails_asked %}
<dt>{% trans "Attendee email" %}</dt>
<dd>{% if line.attendee_email %}{{ line.attendee_email }}{% else %}
<em>{% trans "not answered" %}</em>{% endif %}</dd>
{% endif %}
{% for q in line.questions %}
<dt>{{ q.question }}</dt>
<dd>{% if q.answer %}{{ q.answer|linebreaksbr }}{% else %}

View File

@@ -54,6 +54,7 @@ class OrderList(EventPermissionRequiredMixin, ListView):
u = self.request.GET.get("user", "")
qs = qs.filter(
Q(email__icontains=u) | Q(positions__attendee_name__icontains=u)
| Q(positions__attendee_email__icontains=u)
)
if self.request.GET.get("status", "") != "":
s = self.request.GET.get("status", "")
@@ -172,6 +173,7 @@ class OrderDetail(OrderView):
for p in cartpos:
p.has_questions = (
(p.item.admission and self.request.event.settings.attendee_names_asked) or
(p.item.admission and self.request.event.settings.attendee_emails_asked) or
p.item.questions.all()
)
p.cache_answers()