forked from CGM_Public/pretix_original
Quota form: Change item selection field per context (#3839)
* Change item checkbox select to multiselect widget * Make item selection widget dependent on count * Make item selection widget dependent on variable * Adjust widget choices * Fix widget choices * Fix item variation key errors * Simplify code * Fix classname * Improve argument name * Fix widget name
This commit is contained in:
@@ -77,3 +77,19 @@ class Select2ItemVarQuotaMixin(Select2Mixin):
|
||||
|
||||
class Select2ItemVarQuota(Select2ItemVarQuotaMixin, forms.Select):
|
||||
pass
|
||||
|
||||
|
||||
class Select2ItemVarMulti(Select2Mixin, forms.SelectMultiple):
|
||||
def options(self, name, value, attrs=None):
|
||||
# we need this for multi-selection without a queryset for the selection of items and variations
|
||||
for i, v in enumerate(value):
|
||||
yield self.create_option(
|
||||
None,
|
||||
v,
|
||||
dict(self.choices)[v],
|
||||
True,
|
||||
i,
|
||||
subindex=None,
|
||||
attrs=attrs
|
||||
)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user