forked from CGM_Public/pretix_original
Introduce Item.show_quota_left
This commit is contained in:
18
src/pretix/base/migrations/0126_item_show_quota_left.py
Normal file
18
src/pretix/base/migrations/0126_item_show_quota_left.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.1 on 2019-07-10 13:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pretixbase', '0125_voucher_show_hidden_items'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='item',
|
||||
name='show_quota_left',
|
||||
field=models.NullBooleanField(),
|
||||
),
|
||||
]
|
||||
@@ -308,6 +308,11 @@ class Item(LoggedModel):
|
||||
verbose_name=_("Generate tickets"),
|
||||
blank=True, null=True,
|
||||
)
|
||||
show_quota_left = models.NullBooleanField(
|
||||
verbose_name=_("Show number of tickets left"),
|
||||
help_text=_("Publicly show how many tickets are still available."),
|
||||
blank=True, null=True,
|
||||
)
|
||||
position = models.IntegerField(
|
||||
default=0
|
||||
)
|
||||
@@ -410,6 +415,12 @@ class Item(LoggedModel):
|
||||
if self.event:
|
||||
self.event.cache.clear()
|
||||
|
||||
@property
|
||||
def do_show_quota_left(self):
|
||||
if self.show_quota_left is None:
|
||||
return self.event.settings.show_quota_left
|
||||
return self.show_quota_left
|
||||
|
||||
def tax(self, price=None, base_price_is='auto', currency=None, include_bundled=False):
|
||||
price = price if price is not None else self.default_price
|
||||
|
||||
|
||||
Reference in New Issue
Block a user