Recipe app&model
This commit is contained in:
parent
9620d35ade
commit
4de2ca4ef1
0
apps/recipe/__init__.py
Normal file
0
apps/recipe/__init__.py
Normal file
8
apps/recipe/apps.py
Normal file
8
apps/recipe/apps.py
Normal file
|
|
@ -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')
|
||||||
0
apps/recipe/migrations/__init__.py
Normal file
0
apps/recipe/migrations/__init__.py
Normal file
44
apps/recipe/models.py
Normal file
44
apps/recipe/models.py
Normal file
|
|
@ -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')
|
||||||
|
|
@ -63,6 +63,7 @@ PROJECT_APPS = [
|
||||||
'news.apps.NewsConfig',
|
'news.apps.NewsConfig',
|
||||||
'notification.apps.NotificationConfig',
|
'notification.apps.NotificationConfig',
|
||||||
'partner.apps.PartnerConfig',
|
'partner.apps.PartnerConfig',
|
||||||
|
'recipe.apps.RecipeConfig',
|
||||||
'search_indexes.apps.SearchIndexesConfig',
|
'search_indexes.apps.SearchIndexesConfig',
|
||||||
'translation.apps.TranslationConfig',
|
'translation.apps.TranslationConfig',
|
||||||
'configuration.apps.ConfigurationConfig',
|
'configuration.apps.ConfigurationConfig',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user