Include category in ItemCreateForm

This commit is contained in:
Raphael Michel
2017-04-21 14:35:45 +02:00
parent 5a68eb345f
commit f639d2aa57
2 changed files with 3 additions and 0 deletions

View File

@@ -110,6 +110,7 @@ class ItemCreateForm(I18nModelForm):
def __init__(self, *args, **kwargs):
self.event = kwargs['event']
super().__init__(*args, **kwargs)
self.fields['category'].queryset = self.instance.event.categories.all()
self.fields['copy_from'] = forms.ModelChoiceField(
label=_("Copy product information"),
queryset=self.event.items.all(),
@@ -140,6 +141,7 @@ class ItemCreateForm(I18nModelForm):
localized_fields = '__all__'
fields = [
'name',
'category',
'admission',
'default_price',
'tax_rate',

View File

@@ -9,6 +9,7 @@
{% bootstrap_field form.name layout="horizontal" %}
{% bootstrap_field form.copy_from layout="horizontal" %}
{% bootstrap_field form.has_variations layout="horizontal" %}
{% bootstrap_field form.category layout="horizontal" %}
{% bootstrap_field form.admission layout="horizontal" %}
</fieldset>
<fieldset>