Skip to content
Snippets Groups Projects
Commit 7a00f9cd authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Make showing name and product optional

parent 36ca2426
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,14 @@ class PublicRegistrationsForm(SettingsForm): ...@@ -20,6 +20,14 @@ class PublicRegistrationsForm(SettingsForm):
required=True, required=True,
choices=[], choices=[],
) )
public_registrations_show_attendee_name = forms.BooleanField(
label=_('Show attendee name'),
required=False,
)
public_registrations_show_item_name = forms.BooleanField(
label=_('Show product name'),
required=False,
)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
......
...@@ -13,6 +13,8 @@ from pretix.base.settings import settings_hierarkey ...@@ -13,6 +13,8 @@ from pretix.base.settings import settings_hierarkey
settings_hierarkey.add_default('public_registrations_items', None, list) settings_hierarkey.add_default('public_registrations_items', None, list)
settings_hierarkey.add_default('public_registrations_questions', None, list) settings_hierarkey.add_default('public_registrations_questions', None, list)
settings_hierarkey.add_default('public_registrations_show_attendee_name', False, bool)
settings_hierarkey.add_default('public_registrations_show_item_name', False, bool)
@receiver(html_head, dispatch_uid="public_registrations_html_head") @receiver(html_head, dispatch_uid="public_registrations_html_head")
...@@ -49,7 +51,11 @@ def add_public_registrations_table(sender, **kwargs): ...@@ -49,7 +51,11 @@ def add_public_registrations_table(sender, **kwargs):
if cached is None: if cached is None:
cached = "" cached = ""
public_questions = sender.questions.filter(pk__in=sender.settings.get('public_registrations_questions')) public_questions = sender.questions.filter(pk__in=sender.settings.get('public_registrations_questions'))
headers = [_("Name")] + [ headers = (
[_("Product")] if sender.settings.get('public_registrations_show_item_name') else []
) + (
[_("Name")] if sender.settings.get('public_registrations_show_attendee_name') else []
) + [
q.question for q in public_questions q.question for q in public_questions
] ]
order_positions = OrderPosition.objects.filter(order__event=sender, item__pk__in=sender.settings.get('public_registrations_items')) order_positions = OrderPosition.objects.filter(order__event=sender, item__pk__in=sender.settings.get('public_registrations_items'))
...@@ -67,7 +73,11 @@ def add_public_registrations_table(sender, **kwargs): ...@@ -67,7 +73,11 @@ def add_public_registrations_table(sender, **kwargs):
public_registrations = [ public_registrations = [
{ {
'gr_url': get_gravatar_url(pop.attendee_email, size=24, default="wavatar"), 'gr_url': get_gravatar_url(pop.attendee_email, size=24, default="wavatar"),
'fields': [pop.attendee_name_cached] + [ 'fields': (
[pop.item.name] if sender.settings.get('public_registrations_show_item_name') else []
) + (
[pop.attendee_name_cached] if sender.settings.get('public_registrations_show_attendee_name') else []
) + [
public_answers[pop.pk][pq.pk].answer if public_answers.get(pop.pk, None) and public_answers[pop.pk].get(pq.pk, None) else '' public_answers[pop.pk][pq.pk].answer if public_answers.get(pop.pk, None) and public_answers[pop.pk].get(pq.pk, None) else ''
for pq in public_questions for pq in public_questions
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment