forked from CGM_Public/pretix_original
This commit is contained in:
committed by
GitHub
parent
b20797fe4b
commit
70e4b02370
@@ -44,7 +44,7 @@ import dateutil.parser
|
|||||||
import pytz
|
import pytz
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import MinValueValidator, RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils import formats
|
from django.utils import formats
|
||||||
@@ -479,12 +479,14 @@ class Item(LoggedModel):
|
|||||||
min_per_order = models.IntegerField(
|
min_per_order = models.IntegerField(
|
||||||
verbose_name=_('Minimum amount per order'),
|
verbose_name=_('Minimum amount per order'),
|
||||||
null=True, blank=True,
|
null=True, blank=True,
|
||||||
|
validators=[MinValueValidator(0)],
|
||||||
help_text=_('This product can only be bought if it is added to the cart at least this many times. If you keep '
|
help_text=_('This product can only be bought if it is added to the cart at least this many times. If you keep '
|
||||||
'the field empty or set it to 0, there is no special limit for this product.')
|
'the field empty or set it to 0, there is no special limit for this product.')
|
||||||
)
|
)
|
||||||
max_per_order = models.IntegerField(
|
max_per_order = models.IntegerField(
|
||||||
verbose_name=_('Maximum amount per order'),
|
verbose_name=_('Maximum amount per order'),
|
||||||
null=True, blank=True,
|
null=True, blank=True,
|
||||||
|
validators=[MinValueValidator(0)],
|
||||||
help_text=_('This product can only be bought at most this many times within one order. If you keep the field '
|
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 '
|
'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.')
|
'number of items in the whole order applies regardless.')
|
||||||
|
|||||||
@@ -627,7 +627,9 @@ class ItemUpdateForm(I18nModelForm):
|
|||||||
'class': 'scrolling-multiple-choice'
|
'class': 'scrolling-multiple-choice'
|
||||||
}),
|
}),
|
||||||
'generate_tickets': TicketNullBooleanSelect(),
|
'generate_tickets': TicketNullBooleanSelect(),
|
||||||
'show_quota_left': ShowQuotaNullBooleanSelect()
|
'show_quota_left': ShowQuotaNullBooleanSelect(),
|
||||||
|
'max_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
|
||||||
|
'min_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user