Skip to content

Commit

Permalink
verbose names for models and added plugin configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
petrceska committed Sep 27, 2023
1 parent 1ddfc82 commit 1401f2d
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 20 deletions.
19 changes: 14 additions & 5 deletions fiesta/apps/events/models/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@


class EventsConfiguration(BasePluginConfiguration):
require_confirmation = models.BooleanField(default=True)
require_confirmation = models.BooleanField(
default=True,
verbose_name=_("require confirmation to publish"),
)

members_can_create = models.BooleanField(
default=True,
verbose_name=_("basic members can create an event"),
)

online_purchases = models.BooleanField(
default=True,
verbose_name=_("online purchases"),
)

class Meta:
verbose_name = _('events configuration')
verbose_name_plural = _('events configurations')


__all__ = ['EventsConfiguration']

# TODO can be created by
# TODO can be confirmed by
# TODO section is selling events online
8 changes: 5 additions & 3 deletions fiesta/apps/events/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ class Event(BaseTimestampedModel):
landscape_cover = models.ImageField(
storage=event_landscape_cover_photo_storage,
upload_to=event_landscape_cover_photo_storage.upload_to,
verbose_name=_("landscape_cover"),
verbose_name=_("landscape cover photo"),
null=True,
blank=True,
)

portrait_cover = models.ImageField(
storage=event_portrait_cover_photo_storage,
upload_to=event_portrait_cover_photo_storage.upload_to,
verbose_name=_("portrait_cover"),
verbose_name=_("portrait cover photo"),
null=True,
blank=True,
)
Expand Down Expand Up @@ -123,11 +123,13 @@ class Event(BaseTimestampedModel):
)

def __str__(self):
# return self.title
return f"{self.title} - {self.start}"

class Meta:
ordering = ["start"]
verbose_name = _("Event")
verbose_name = _("event")
verbose_name_plural = _('events')


__all__ = ["Event"]
Expand Down
3 changes: 2 additions & 1 deletion fiesta/apps/events/models/organizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class Organizer(BaseTimestampedModel):
)

class Meta:
verbose_name = _("Organizer")
verbose_name = _("organizer")
verbose_name_plural = _('organizers')
unique_together = (("user", "event"),)


Expand Down
8 changes: 6 additions & 2 deletions fiesta/apps/events/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class State(models.TextChoices): # TODO do we need a state if we have an expira
class Participant(BaseModel):

created = models.DateTimeField(
verbose_name=_("created"),
verbose_name=_("created at"),
help_text=_("when the user placed the ordered (does not have to be paid)"),
)

Expand All @@ -25,6 +25,7 @@ class Participant(BaseModel):
on_delete=models.SET_NULL,
null=True,
db_index=True,
verbose_name=_("user"),
)

event = models.ForeignKey(
Expand All @@ -33,11 +34,13 @@ class Participant(BaseModel):
related_name="event",
null=True,
db_index=True,
verbose_name=_("event"),
)

price = models.ForeignKey(
to="events.PriceVariant",
on_delete=models.SET_NULL,
verbose_name=_("price"),
related_name="price",
null=True,
db_index=False,
Expand All @@ -48,7 +51,8 @@ def __str__(self):

class Meta:
unique_together = (("event", "user"),)
verbose_name = _("Participant")
verbose_name = _("participant")
verbose_name_plural = _("participants")
ordering = ["created"]


Expand Down
7 changes: 4 additions & 3 deletions fiesta/apps/events/models/place.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class Place(BaseModel):

link = models.CharField(
max_length=256,
verbose_name=_("link"),
verbose_name=_("webpage link"),
help_text=_("Link to the place"),
null=True,
blank=True,
)

map_link = models.CharField(
max_length=256,
verbose_name=_("map_link"),
verbose_name=_("map link"),
help_text=_("Link to a position to the place on a map"),
null=True,
blank=True,
Expand All @@ -48,7 +48,8 @@ def __str__(self):
return self.name

class Meta:
verbose_name = _("Place")
verbose_name = _("place")
verbose_name_plural = _('places')
unique_together = (("section", "name"),)


Expand Down
17 changes: 11 additions & 6 deletions fiesta/apps/events/models/price_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ class PriceVariant(BaseModel):
help_text=_("full name of the price"),
)

type = models.CharField(max_length=255, choices=EventPriceVariantType.choices)
type = models.CharField(max_length=255,
choices=EventPriceVariantType.choices,
verbose_name=_("type"),
)

amount = MoneyField(max_digits=10, decimal_places=2, default_currency='CZK')
amount = MoneyField(max_digits=10,
decimal_places=2,
default_currency='CZK',
verbose_name=_("amount"),
)

event = models.ForeignKey(
"events.Event",
Expand Down Expand Up @@ -76,10 +83,8 @@ class PriceVariant(BaseModel):

class Meta:
unique_together = (("title", "event"),)
verbose_name = _('price variant')
verbose_name_plural = _('price variants')


__all__ = ["PriceVariant"]

# e = Event()
#
# e.price_variants.create(type=EventPriceVariantType.STANDARD, price=100)
Empty file.

0 comments on commit 1401f2d

Please sign in to comment.