March 2020
Intermediate to advanced
608 pages
17h 17m
English
Let's create a new app called ideas and put it in INSTALLED_APPS in the settings. Create the following Idea model with an IdeaTranslations model for translations inside of that app:
# myproject/apps/idea/models.pyimport uuidfrom django.db import modelsfrom django.urls import reversefrom django.conf import settingsfrom django.utils.translation import gettext_lazy as _from myproject.apps.core.model_fields import TranslatedFieldfrom myproject.apps.core.models import ( CreationModificationDateBase, UrlBase)RATING_CHOICES = ( (1, "★☆☆☆☆"), (2, "★★☆☆☆"), (3, "★★★☆☆"), (4, "★★★★☆"), (5, "★★★★★"),)class Idea(CreationModificationDateBase, UrlBase): uuid = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False ) author ...