Add company and address fields to attendees (#1633)

* Add company and address fields to attendees

* Update src/pretix/control/templates/pretixcontrol/event/settings.html

Co-Authored-By: Martin Gross <gross@rami.io>

Co-authored-by: Martin Gross <gross@rami.io>
This commit is contained in:
Raphael Michel
2020-04-02 14:41:09 +02:00
committed by GitHub
parent b498d45621
commit 2c9b2620ea
24 changed files with 632 additions and 40 deletions

View File

@@ -488,6 +488,16 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
if cp.item.admission and self.request.event.settings.get('attendee_company_required', as_type=bool) \
and cp.company is None:
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
if cp.item.admission and self.request.event.settings.get('attendee_attendees_required', as_type=bool) \
and (cp.street is None or cp.city is None or cp.country is None):
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
responses = question_form_fields.send(sender=self.request.event, position=cp)
form_data = cp.meta_info_data.get('question_form_data', {})

View File

@@ -44,12 +44,51 @@
{% if line.has_questions %}
<dl>
{% if line.item.admission and event.settings.attendee_names_asked %}
<dt>{% trans "Attendee name" %}</dt>
<dd>{% if line.attendee_name %}{{ line.attendee_name }}{% else %}<em>{% trans "not answered" %}</em>{% endif %}</dd>
<dt class="sr-only">
{% trans "Attendee name" %}
</dt>
<dd class="toplevel">
<span data-toggle="tooltip" title="{% trans "Attendee name" %}">
{% if line.attendee_name %}{{ line.attendee_name }}{% else %}<em>{% trans "not answered" %}</em>{% endif %}
</span>
</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>
<dt class="sr-only">
{% trans "Attendee email" %}
</dt>
<dd class="toplevel">
<span data-toggle="tooltip" title="{% trans "Attendee email" %}">
{% if line.attendee_email %}{{ line.attendee_email }}{% else %}<em>{% trans "not answered" %}</em>{% endif %}
</span>
</dd>
{% endif %}
{% if line.item.admission and event.settings.attendee_company_asked %}
<dt class="sr-only">
{% trans "Attendee company" %}
</dt>
<dd class="toplevel">
<span data-toggle="tooltip" title="{% trans "Attendee company" %}">
{% if line.company %}{{ line.company }}{% else %}<em>{% trans "not answered" %}</em>{% endif %}
</span>
</dd>
{% endif %}
{% if line.item.admission and event.settings.attendee_addresses_asked %}
<dt class="sr-only">
{% trans "Attendee address" %}
</dt>
<dd class="toplevel">
<span data-toggle="tooltip" title="{% trans "Attendee address" %}">
{% if line.street or line.zipcode or line.city or line.country %}
{{ line.street|linebreaksbr }}<br>
{{ line.zipcode }} {{ line.city }}<br>
{{ line.country.name }}
{% if line.state %}<br>{{ line.state }}{% endif %}
{% else %}
<em>{% trans "not answered" %}</em>
{% endif %}
</span>
</dd>
{% endif %}
{% for q in line.questions %}
<dt>{{ q.question }}</dt>