From 92fb6828671066b7c1e6889bb88c9a41df481dcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Thu, 13 Jun 2019 23:51:24 +0200
Subject: [PATCH] Add a public registration question to products

---
 .../locale/de/LC_MESSAGES/django.po              |  9 ++++++++-
 .../locale/de_Informal/LC_MESSAGES/django.po     |  9 ++++++++-
 pretix_public_registrations/signals.py           | 16 +++++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/pretix_public_registrations/locale/de/LC_MESSAGES/django.po b/pretix_public_registrations/locale/de/LC_MESSAGES/django.po
index 6f64fba..f0a5287 100644
--- a/pretix_public_registrations/locale/de/LC_MESSAGES/django.po
+++ b/pretix_public_registrations/locale/de/LC_MESSAGES/django.po
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-03-07 19:01+0100\n"
+"POT-Creation-Date: 2019-06-13 23:47+0200\n"
 "PO-Revision-Date: \n"
 "Last-Translator: Felix Schäfer\n"
 "Language-Team: \n"
@@ -10,3 +10,10 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.2.3\n"
+"X-Poedit-Basepath: ../../..\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: signals.py:11
+msgid "Public registration"
+msgstr "Öffentliche Anmeldung"
diff --git a/pretix_public_registrations/locale/de_Informal/LC_MESSAGES/django.po b/pretix_public_registrations/locale/de_Informal/LC_MESSAGES/django.po
index 6f64fba..3aed04c 100644
--- a/pretix_public_registrations/locale/de_Informal/LC_MESSAGES/django.po
+++ b/pretix_public_registrations/locale/de_Informal/LC_MESSAGES/django.po
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-03-07 19:01+0100\n"
+"POT-Creation-Date: 2019-06-13 23:49+0200\n"
 "PO-Revision-Date: \n"
 "Last-Translator: Felix Schäfer\n"
 "Language-Team: \n"
@@ -10,3 +10,10 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.2.3\n"
+"X-Poedit-Basepath: ../../..\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: signals.py:11
+msgid "Public registration"
+msgstr "Öffentliche Anmeldung"
diff --git a/pretix_public_registrations/signals.py b/pretix_public_registrations/signals.py
index a025794..1f9aff0 100644
--- a/pretix_public_registrations/signals.py
+++ b/pretix_public_registrations/signals.py
@@ -1 +1,15 @@
-# Register your receivers here
+from django import forms
+from django.dispatch import receiver
+from django.utils.translation import ugettext_lazy as _
+from i18nfield.strings import LazyI18nString
+from pretix.presale.signals import question_form_fields
+
+
+@receiver(question_form_fields, dispatch_uid="pretix_public_registration_question")
+def add_public_registration_question(sender, **kwargs):
+    return {'public_registration': forms.CharField(
+        label=_('Public registration'),
+        required=False,
+        help_text=sender.settings.get('public_registration_field_help_text', as_type=LazyI18nString),
+        widget=forms.CheckboxInput(),
+    )}
-- 
GitLab