Fix #782 -- Select2 widget for item selection for vouchers

This commit is contained in:
Raphael Michel
2018-04-03 12:10:34 +02:00
parent 7ec5adb6b4
commit bb10d25561
6 changed files with 163 additions and 36 deletions

View File

@@ -36,3 +36,23 @@ class Select2(Select2Mixin, forms.Select):
class Select2Multiple(Select2Mixin, forms.SelectMultiple):
pass
class Select2ItemVarQuotaMixin(Select2Mixin):
def options(self, name, value, attrs=None):
if value and value[0]:
yield self.create_option(
None,
value[0],
value[0],
True,
0,
subindex=None,
attrs=attrs
)
return
class Select2ItemVarQuota(Select2ItemVarQuotaMixin, forms.Select):
pass