From 1401f2d5804f4a3a9837346c48acba88e5780db0 Mon Sep 17 00:00:00 2001 From: petrceska Date: Wed, 27 Sep 2023 21:16:59 +0200 Subject: [PATCH] verbose names for models and added plugin configuration options --- fiesta/apps/events/models/configuration.py | 19 ++++++++++++++----- fiesta/apps/events/models/event.py | 8 +++++--- fiesta/apps/events/models/organizer.py | 3 ++- fiesta/apps/events/models/participant.py | 8 ++++++-- fiesta/apps/events/models/place.py | 7 ++++--- fiesta/apps/events/models/price_variant.py | 17 +++++++++++------ fiesta/apps/events/templatetags/__init__.py | 0 7 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 fiesta/apps/events/templatetags/__init__.py diff --git a/fiesta/apps/events/models/configuration.py b/fiesta/apps/events/models/configuration.py index b08f4d8b..df0c7cb7 100644 --- a/fiesta/apps/events/models/configuration.py +++ b/fiesta/apps/events/models/configuration.py @@ -5,7 +5,20 @@ 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') @@ -13,7 +26,3 @@ class Meta: __all__ = ['EventsConfiguration'] - -# TODO can be created by -# TODO can be confirmed by -# TODO section is selling events online \ No newline at end of file diff --git a/fiesta/apps/events/models/event.py b/fiesta/apps/events/models/event.py index cf7a12c3..aa8da801 100644 --- a/fiesta/apps/events/models/event.py +++ b/fiesta/apps/events/models/event.py @@ -81,7 +81,7 @@ 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, ) @@ -89,7 +89,7 @@ class Event(BaseTimestampedModel): 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, ) @@ -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"] diff --git a/fiesta/apps/events/models/organizer.py b/fiesta/apps/events/models/organizer.py index ce3a0fff..a7043da3 100644 --- a/fiesta/apps/events/models/organizer.py +++ b/fiesta/apps/events/models/organizer.py @@ -38,7 +38,8 @@ class Organizer(BaseTimestampedModel): ) class Meta: - verbose_name = _("Organizer") + verbose_name = _("organizer") + verbose_name_plural = _('organizers') unique_together = (("user", "event"),) diff --git a/fiesta/apps/events/models/participant.py b/fiesta/apps/events/models/participant.py index 6cf2ea84..58c6038e 100644 --- a/fiesta/apps/events/models/participant.py +++ b/fiesta/apps/events/models/participant.py @@ -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)"), ) @@ -25,6 +25,7 @@ class Participant(BaseModel): on_delete=models.SET_NULL, null=True, db_index=True, + verbose_name=_("user"), ) event = models.ForeignKey( @@ -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, @@ -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"] diff --git a/fiesta/apps/events/models/place.py b/fiesta/apps/events/models/place.py index 0c5b0f8d..2ed56c2b 100644 --- a/fiesta/apps/events/models/place.py +++ b/fiesta/apps/events/models/place.py @@ -23,7 +23,7 @@ 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, @@ -31,7 +31,7 @@ class Place(BaseModel): 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, @@ -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"),) diff --git a/fiesta/apps/events/models/price_variant.py b/fiesta/apps/events/models/price_variant.py index b310475a..b359dba0 100644 --- a/fiesta/apps/events/models/price_variant.py +++ b/fiesta/apps/events/models/price_variant.py @@ -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", @@ -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) diff --git a/fiesta/apps/events/templatetags/__init__.py b/fiesta/apps/events/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b