Add more sourcefields for datasync (#5378)

* add email domain field

* add order and ticket URL fields

* add "is admission product" field

* fix types

* Display sourcefields grouped into categories (#5379)
This commit is contained in:
luelista
2025-08-18 12:07:50 +02:00
committed by GitHub
parent 626d7ecc90
commit 527bc83e5f
2 changed files with 123 additions and 4 deletions

View File

@@ -19,6 +19,8 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from itertools import groupby
from django import forms
from django.forms import formset_factory
from django.utils.translation import gettext_lazy as _
@@ -116,8 +118,13 @@ QUESTION_TYPE_LABELS = dict(Question.TYPE_CHOICES)
def pretix_fields_choices(pretix_fields, initial_choice):
pretix_fields = sorted(pretix_fields, key=lambda f: f.category)
grouped_fields = groupby(pretix_fields, lambda f: f.category)
return [
(f.key, f.label + " [" + QUESTION_TYPE_LABELS[f.type] + "]")
for f in pretix_fields
if not f.deprecated or f.key == initial_choice
(f"{cat}", [
(f.key, f.label + " [" + QUESTION_TYPE_LABELS[f.type] + "]")
for f in fields
if not f.deprecated or f.key == initial_choice
])
for ((idx, cat), fields) in grouped_fields
]