Introduce Item.show_quota_left

This commit is contained in:
Raphael Michel
2019-07-10 16:08:21 +02:00
parent 6d6cd3b7cf
commit 491753008d
10 changed files with 63 additions and 7 deletions

View 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(),
),
]

View File

@@ -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