You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
48 lines
1.5 KiB
from django.db import models
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
class CalendarOccasions(models.Model):
|
|
"""
|
|
calendar events model
|
|
"""
|
|
|
|
class OccasionType(models.TextChoices):
|
|
GEORGIAN = 'georgian', _('georgian')
|
|
LUNAR = 'lunar', _('lunar')
|
|
|
|
class EventType(models.TextChoices):
|
|
national = 'national', _('National')
|
|
international = 'international', _('International')
|
|
religious = 'religious', _('Religious')
|
|
|
|
title = models.CharField(_("title"), max_length=255)
|
|
is_global = models.BooleanField(
|
|
verbose_name=_('is global'), default=False,
|
|
help_text=_('check this field if event is global'),
|
|
)
|
|
|
|
occasion_type = models.CharField(
|
|
choices=OccasionType.choices,
|
|
default=OccasionType.GEORGIAN,
|
|
max_length=12,
|
|
help_text=_('Choose between georgian or lunar. default to georgian'),
|
|
verbose_name=_('occasion type')
|
|
)
|
|
dates = models.JSONField(verbose_name=_('dates'))
|
|
is_yearly = models.BooleanField(
|
|
verbose_name=_('is yearly'), default=True,
|
|
help_text=_('check this field if event is annually')
|
|
)
|
|
updated_at = models.DateTimeField(auto_now=True, verbose_name=_('updated at'))
|
|
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_('created at'))
|
|
event_type = models.CharField(max_length=16, choices=EventType.choices, null=True, verbose_name=_('event type'))
|
|
|
|
class Meta:
|
|
ordering = ('-updated_at',)
|
|
|
|
def __str__(self) -> str:
|
|
return self.title
|
|
|
|
|