forked from CGM_Public/pretix_original
Introduce Item.show_quota_left
This commit is contained in:
@@ -174,7 +174,7 @@ class AddOnsForm(forms.Form):
|
||||
elif avail[0] < 100:
|
||||
n += ' – {}'.format(_('Currently unavailable'))
|
||||
else:
|
||||
if avail[1] is not None and event.settings.show_quota_left:
|
||||
if avail[1] is not None and item.do_show_quota_left:
|
||||
n += ' – {}'.format(_('%(num)s currently available') % {'num': avail[1]})
|
||||
|
||||
if not isinstance(item_or_variation, ItemVariation) and item.picture:
|
||||
@@ -236,6 +236,7 @@ class AddOnsForm(forms.Form):
|
||||
to_attr='_subevent_quotas',
|
||||
queryset=event.quotas.filter(subevent=subevent))
|
||||
).distinct()),
|
||||
'event'
|
||||
).annotate(
|
||||
quotac=Count('quotas'),
|
||||
has_variations=Count('variations')
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
{{ var.description|localize|rich_text }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if event.settings.show_quota_left %}
|
||||
{% if item.do_show_quota_left %}
|
||||
{% include "pretixpresale/event/fragment_quota_left.html" with avail=var.cached_availability %}
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -187,7 +187,7 @@
|
||||
{{ item.description|localize|rich_text }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if event.settings.show_quota_left %}
|
||||
{% if item.do_show_quota_left %}
|
||||
{% include "pretixpresale/event/fragment_quota_left.html" with avail=item.cached_availability %}
|
||||
{% endif %}
|
||||
{% if item.min_per_order and item.min_per_order > 1 %}
|
||||
|
||||
@@ -198,7 +198,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
'free_price': item.free_price,
|
||||
'avail': [
|
||||
item.cached_availability[0],
|
||||
item.cached_availability[1] if self.request.event.settings.show_quota_left else None
|
||||
item.cached_availability[1] if item.do_show_quota_left else None
|
||||
] if not item.has_variations else None,
|
||||
'original_price': (
|
||||
(item.original_price.net
|
||||
@@ -228,7 +228,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
),
|
||||
'avail': [
|
||||
var.cached_availability[0],
|
||||
var.cached_availability[1] if self.request.event.settings.show_quota_left else None
|
||||
var.cached_availability[1] if item.do_show_quota_left else None
|
||||
],
|
||||
} for var in item.available_variations
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user