Add constraint for a maximum number of a ticket per order

This commit is contained in:
Raphael Michel
2017-03-24 17:11:48 +01:00
parent 36d6b6f9ab
commit 69faab01b2
10 changed files with 141 additions and 4 deletions

View File

@@ -111,6 +111,8 @@ class Item(LoggedModel):
:type hide_without_voucher: bool
:param allow_cancel: If set to ``False``, an order with this product can not be canceled by the user.
:type allow_cancel: bool
:param max_per_order: Maximum number of times this item can be in an order. None for unlimited.
:type max_per_order: int
"""
event = models.ForeignKey(
@@ -203,6 +205,13 @@ class Item(LoggedModel):
'canceled by the user until the order is paid for. Users cannot cancel paid orders on their own '
'and you can cancel orders at all times, regardless of this setting')
)
max_per_order = models.IntegerField(
verbose_name=_('Maximum amount per order'),
null=True, blank=True,
help_text=_('This product can only be bought at most this many times within one order. If you keep the field '
'empty or set it to 0, there is no special limit for this product. The limit for the maximum '
'number of items in the whole order applies regardless.')
)
class Meta:
verbose_name = _("Product")