mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Fixed a bug with restrictions that set the price to None
This commit is contained in:
@@ -29,7 +29,6 @@ from .types import VariationDict
|
|||||||
|
|
||||||
|
|
||||||
class Versionable(BaseVersionable):
|
class Versionable(BaseVersionable):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@@ -491,6 +490,7 @@ class Event(Versionable):
|
|||||||
is being cleared every time the event or one of its related objects change.
|
is being cleared every time the event or one of its related objects change.
|
||||||
"""
|
"""
|
||||||
from pretix.base.cache import EventRelatedCache
|
from pretix.base.cache import EventRelatedCache
|
||||||
|
|
||||||
return EventRelatedCache(self)
|
return EventRelatedCache(self)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
@@ -1025,7 +1025,7 @@ class Item(Versionable):
|
|||||||
for receiver, response in responses:
|
for receiver, response in responses:
|
||||||
if 'available' in response[i]:
|
if 'available' in response[i]:
|
||||||
var['available'] &= response[i]['available']
|
var['available'] &= response[i]['available']
|
||||||
if 'price' in response[i] and response[i]['price'] \
|
if 'price' in response[i] and response[i]['price'] is not None \
|
||||||
and response[i]['price'] < var['price']:
|
and response[i]['price'] < var['price']:
|
||||||
var['price'] = response[i]['price']
|
var['price'] = response[i]['price']
|
||||||
|
|
||||||
@@ -1064,6 +1064,7 @@ class Item(Versionable):
|
|||||||
raise ValueError('Do not call this directly on items which have properties '
|
raise ValueError('Do not call this directly on items which have properties '
|
||||||
'but call this on their ItemVariation objects')
|
'but call this on their ItemVariation objects')
|
||||||
from .signals import determine_availability
|
from .signals import determine_availability
|
||||||
|
|
||||||
vd = VariationDict()
|
vd = VariationDict()
|
||||||
responses = determine_availability.send(
|
responses = determine_availability.send(
|
||||||
self.event, item=self,
|
self.event, item=self,
|
||||||
@@ -1074,7 +1075,7 @@ class Item(Versionable):
|
|||||||
for receiver, response in responses:
|
for receiver, response in responses:
|
||||||
if 'available' in response[0] and not response[0]['available']:
|
if 'available' in response[0] and not response[0]['available']:
|
||||||
return False
|
return False
|
||||||
elif 'price' in response[0] and response[0]['price'] < price:
|
elif 'price' in response[0] and response[0]['price'] is not None and response[0]['price'] < price:
|
||||||
price = response[0]['price']
|
price = response[0]['price']
|
||||||
return price
|
return price
|
||||||
|
|
||||||
@@ -1172,6 +1173,7 @@ class ItemVariation(Versionable):
|
|||||||
* the item's price, otherwise
|
* the item's price, otherwise
|
||||||
"""
|
"""
|
||||||
from .signals import determine_availability
|
from .signals import determine_availability
|
||||||
|
|
||||||
responses = determine_availability.send(
|
responses = determine_availability.send(
|
||||||
self.item.event, item=self.item,
|
self.item.event, item=self.item,
|
||||||
variations=[self.to_variation_dict()], context=None,
|
variations=[self.to_variation_dict()], context=None,
|
||||||
@@ -1181,7 +1183,7 @@ class ItemVariation(Versionable):
|
|||||||
for receiver, response in responses:
|
for receiver, response in responses:
|
||||||
if 'available' in response[0] and not response[0]['available']:
|
if 'available' in response[0] and not response[0]['available']:
|
||||||
return False
|
return False
|
||||||
elif 'price' in response[0] and response[0]['price'] < price:
|
elif 'price' in response[0] and response[0]['price'] is not None and response[0]['price'] < price:
|
||||||
price = response[0]['price']
|
price = response[0]['price']
|
||||||
return price
|
return price
|
||||||
|
|
||||||
@@ -1209,6 +1211,7 @@ class VariationsField(VersionedManyToManyField):
|
|||||||
def formfield(self, **kwargs):
|
def formfield(self, **kwargs):
|
||||||
from pretix.control.forms import VariationsField as FVariationsField
|
from pretix.control.forms import VariationsField as FVariationsField
|
||||||
from django.db.models.fields.related import RelatedField
|
from django.db.models.fields.related import RelatedField
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
'form_class': FVariationsField,
|
'form_class': FVariationsField,
|
||||||
# We don't need a queryset
|
# We don't need a queryset
|
||||||
@@ -1429,6 +1432,7 @@ class Quota(Versionable):
|
|||||||
to obtain the lock
|
to obtain the lock
|
||||||
"""
|
"""
|
||||||
from .services import locking
|
from .services import locking
|
||||||
|
|
||||||
return locking.lock_quota(self)
|
return locking.lock_quota(self)
|
||||||
|
|
||||||
def release(self, force=False):
|
def release(self, force=False):
|
||||||
@@ -1438,6 +1442,7 @@ class Quota(Versionable):
|
|||||||
representation of the database object.
|
representation of the database object.
|
||||||
"""
|
"""
|
||||||
from .services import locking
|
from .services import locking
|
||||||
|
|
||||||
return locking.release_quota(self, force)
|
return locking.release_quota(self, force)
|
||||||
|
|
||||||
|
|
||||||
@@ -1702,7 +1707,6 @@ class QuestionAnswer(Versionable):
|
|||||||
|
|
||||||
|
|
||||||
class ObjectWithAnswers:
|
class ObjectWithAnswers:
|
||||||
|
|
||||||
def cache_answers(self):
|
def cache_answers(self):
|
||||||
"""
|
"""
|
||||||
Creates two properties on the object.
|
Creates two properties on the object.
|
||||||
|
|||||||
Reference in New Issue
Block a user