Skip to content

Commit

Permalink
renaming price to price variant
Browse files Browse the repository at this point in the history
  • Loading branch information
petrceska committed Sep 26, 2023
1 parent bada5a0 commit 1af526e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion fiesta/apps/events/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .organizer import Organizer
from .participant import Participant
from .place import Place
from .price import PriceVariant
from .price_variant import PriceVariant



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class EventPriceVariantType(TextChoices):
WITH_ESN_CARD = "with_esn_card", _("With ESN card")

def is_available(self, variant: PriceVariant, user: User):
to_ = variant.to_
from_ = variant.from_
to_ = variant.available_to
from_ = variant.available_from

if from_ is not None and from_ is not "" and from_ < datetime.now():
return False
Expand All @@ -37,7 +37,6 @@ def is_available(self, variant: PriceVariant, user: User):
class PriceVariant(BaseModel):
title = models.CharField(
max_length=256,
unique=True,
verbose_name=_("title"),
help_text=_("full name of the price"),
)
Expand All @@ -51,17 +50,19 @@ class PriceVariant(BaseModel):
related_name="price_variant",
on_delete=models.CASCADE,
verbose_name=_("event"),
null=True,
db_index=True,
)

from_ = models.DateTimeField(
verbose_name=_("from"),
available_from = models.DateTimeField(
verbose_name=_("available from"),
help_text=_("From when users can purchase for this price."),
null=True,
blank=True,
)

to_ = models.DateTimeField(
verbose_name=_("to"),
available_to = models.DateTimeField(
verbose_name=_("available to"),
help_text=_("Until when users can purchase for this price."),
null=True,
blank=True,
Expand All @@ -73,6 +74,9 @@ class PriceVariant(BaseModel):
default=dict,
)

class Meta:
unique_together = (("title", "event"),)


__all__ = ["PriceVariant"]

Expand Down

0 comments on commit 1af526e

Please sign in to comment.