mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Add public filters based on meta data (#3673)
* Add public filters based on meta data * Fix licenseheaders * ignore empty values * Fix tests * Full non-widget implementation * Widget support * Add a few tests * Allow to reorder properties * Fix isort * Allow to opt-out for specific events * Fix name clash between new and old field to make migration feasible
This commit is contained in:
@@ -393,12 +393,12 @@ class SubEventMetaValueForm(forms.ModelForm):
|
||||
self.default = kwargs.pop('default', None)
|
||||
self.disabled = kwargs.pop('disabled', False)
|
||||
super().__init__(*args, **kwargs)
|
||||
if self.property.allowed_values:
|
||||
if self.property.choices:
|
||||
self.fields['value'] = forms.ChoiceField(
|
||||
label=self.property.name,
|
||||
choices=[
|
||||
('', _('Default ({value})').format(value=self.default or self.property.default) if self.default or self.property.default else ''),
|
||||
] + [(a.strip(), a.strip()) for a in self.property.allowed_values.splitlines()],
|
||||
] + [(a.strip(), a.strip()) for a in self.property.choice_keys],
|
||||
)
|
||||
else:
|
||||
self.fields['value'].label = self.property.name
|
||||
|
||||
Reference in New Issue
Block a user