mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Allow to explicitly disable products for certain subevents
This commit is contained in:
@@ -99,7 +99,7 @@ class SubEventItemForm(SubEventItemOrVariationFormMixin, forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = SubEventItem
|
||||
fields = ['price']
|
||||
fields = ['price', 'disabled']
|
||||
widgets = {
|
||||
'price': forms.TextInput
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class SubEventItemVariationForm(SubEventItemOrVariationFormMixin, forms.ModelFor
|
||||
|
||||
class Meta:
|
||||
model = SubEventItem
|
||||
fields = ['price']
|
||||
fields = ['price', 'disabled']
|
||||
widgets = {
|
||||
'price': forms.TextInput
|
||||
}
|
||||
|
||||
@@ -461,7 +461,19 @@
|
||||
<fieldset>
|
||||
<legend>{% trans "Item prices" %}</legend>
|
||||
{% for f in itemvar_forms %}
|
||||
{% bootstrap_field f.price addon_after=request.event.currency layout="control" %}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label" for="id_{{ f.prefix }}-price">
|
||||
{% if f.variation %}{{ f.item }} – {{ f.variation }}{% else %}{{ f.item }}{% endif %}
|
||||
<br>
|
||||
<span class="optional">{% trans "Optional" %}</span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
{% bootstrap_field f.price addon_after=request.event.currency form_group_class="" layout="inline" %}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{% bootstrap_field f.disabled layout="inline" form_group_class="" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
||||
@@ -145,7 +145,19 @@
|
||||
<fieldset>
|
||||
<legend>{% trans "Item prices" %}</legend>
|
||||
{% for f in itemvar_forms %}
|
||||
{% bootstrap_field f.price addon_after=request.event.currency layout="control" %}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label" for="id_{{ f.prefix }}-price">
|
||||
{% if f.variation %}{{ f.item }} – {{ f.variation }}{% else %}{{ f.item }}{% endif %}
|
||||
<br>
|
||||
<span class="optional">{% trans "Optional" %}</span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
{% bootstrap_field f.price addon_after=request.event.currency form_group_class="" layout="inline" %}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{% bootstrap_field f.disabled layout="inline" form_group_class="" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
||||
@@ -338,11 +338,11 @@ class SubEventEditorMixin(MetaDataEditorMixin):
|
||||
|
||||
if self.copy_from:
|
||||
se_item_instances = {
|
||||
sei.item_id: SubEventItem(item=sei.item, price=sei.price)
|
||||
sei.item_id: SubEventItem(item=sei.item, price=sei.price, disabled=sei.disabled)
|
||||
for sei in SubEventItem.objects.filter(subevent=self.copy_from).select_related('item')
|
||||
}
|
||||
se_var_instances = {
|
||||
sei.variation_id: SubEventItemVariation(variation=sei.variation, price=sei.price)
|
||||
sei.variation_id: SubEventItemVariation(variation=sei.variation, price=sei.price, disabled=sei.disabled)
|
||||
for sei in SubEventItemVariation.objects.filter(subevent=self.copy_from).select_related('variation')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user