diff --git a/apps/recipe/__init__.py b/apps/recipe/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/recipe/apps.py b/apps/recipe/apps.py new file mode 100644 index 00000000..a05c714d --- /dev/null +++ b/apps/recipe/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class RecipeConfig(AppConfig): + + name = 'recipe' + verbose_name = _('RecipeConfig') diff --git a/apps/recipe/migrations/__init__.py b/apps/recipe/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/recipe/models.py b/apps/recipe/models.py new file mode 100644 index 00000000..f3e5bf2e --- /dev/null +++ b/apps/recipe/models.py @@ -0,0 +1,44 @@ +"""Recipe app models.""" +from django.db import models +from django.utils.translation import ugettext_lazy as _ +from utils.models import (TranslatedFieldsMixin, ImageMixin, BaseAttributes, + TJSONField) + + +class Recipe(TranslatedFieldsMixin, ImageMixin, BaseAttributes): + """Recipe model.""" + + WAITING = 0 + HIDDEN = 1 + PUBLISHED = 2 + PUBLISHED_EXCLUSIVE = 3 + + STATE_CHOICES = ( + (WAITING, _('Waiting')), + (HIDDEN, _('Hidden')), + (PUBLISHED, _('Published')), + (PUBLISHED_EXCLUSIVE, _('Published exclusive')), + ) + + STR_FIELD_NAME = 'title' + + title = TJSONField(blank=True, null=True, default=None, verbose_name=_('Title'), + help_text='{"en-GB": "some text"}') + subtitle = TJSONField(blank=True, null=True, default=None, verbose_name=_('Subtitle'), + help_text='{"en-GB": "some text"}') + description = TJSONField(blank=True, null=True, default=None, verbose_name=_('Description'), + help_text='{"en-GB": "some text"}') + state = models.PositiveSmallIntegerField(default=WAITING, choices=STATE_CHOICES, + verbose_name=_('State')) + published_at = models.DateTimeField(verbose_name=_('Published at'), + blank=True, default=None, null=True, + help_text=_('Published at')) + published_scheduled_at = models.DateTimeField(verbose_name=_('Published scheduled at'), + blank=True, default=None, null=True, + help_text=_('Published scheduled at')) + + class Meta: + """Meta class.""" + + verbose_name = _('Recipe') + verbose_name_plural = _('Recipes') diff --git a/project/settings/base.py b/project/settings/base.py index 1a54b1b7..4aec6f4c 100644 --- a/project/settings/base.py +++ b/project/settings/base.py @@ -63,6 +63,7 @@ PROJECT_APPS = [ 'news.apps.NewsConfig', 'notification.apps.NotificationConfig', 'partner.apps.PartnerConfig', + 'recipe.apps.RecipeConfig', 'search_indexes.apps.SearchIndexesConfig', 'translation.apps.TranslationConfig', 'configuration.apps.ConfigurationConfig',