BO 1.14 descriptions
This commit is contained in:
parent
7459dfdc2d
commit
88bdf7703f
@ -7,4 +7,5 @@ from .exercise_device import ExerciseDeviceAdmin
|
|||||||
from .tutorial import TutorialAdmin
|
from .tutorial import TutorialAdmin
|
||||||
from .evaluation import EvaluationAdmin, EvaluationAttributeAdmin
|
from .evaluation import EvaluationAdmin, EvaluationAttributeAdmin
|
||||||
from .exercise_plan import ExercisePlanAdmin
|
from .exercise_plan import ExercisePlanAdmin
|
||||||
|
from .description import DescriptionAdmin
|
||||||
|
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from ..models.description import DescriptionTranslation, Description
|
||||||
|
from ..models import Description
|
||||||
|
|
||||||
|
|
||||||
|
class TranslationDescriptionInline(admin.TabularInline):
|
||||||
|
model = DescriptionTranslation
|
||||||
|
fields = ('language_code', 'description_translation')
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
|
class DescriptionAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name','version', 'valid_from')
|
||||||
|
fields = ('name','description', 'version', 'valid_from', 'valid_to')
|
||||||
|
|
||||||
|
inlines = [
|
||||||
|
TranslationDescriptionInline,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Description, DescriptionAdmin)
|
||||||
|
admin.autodiscover()
|
@ -10,3 +10,4 @@ from .product import Product, Purchase
|
|||||||
from .property import Property, PropertyTranslation
|
from .property import Property, PropertyTranslation
|
||||||
from .tutorial import Tutorial, TutorialSteps, TutorialTranslation
|
from .tutorial import Tutorial, TutorialSteps, TutorialTranslation
|
||||||
from .evaluation import Evaluation, EvaluationAttribute
|
from .evaluation import Evaluation, EvaluationAttribute
|
||||||
|
from .description import Description, DescriptionTranslation
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from ckeditor.fields import RichTextField
|
||||||
|
|
||||||
|
from .enums import LanguageTypes
|
||||||
|
|
||||||
|
|
||||||
|
class Description(models.Model):
|
||||||
|
description_id = models.AutoField(primary_key=True)
|
||||||
|
name = models.CharField(max_length=50, help_text='Unique description name',
|
||||||
|
verbose_name=_("name"))
|
||||||
|
description = RichTextField()
|
||||||
|
version = models.IntegerField(max_length=3, blank=True)
|
||||||
|
valid_from = models.DateTimeField(blank=True)
|
||||||
|
valid_to = models.DateTimeField(blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'description'
|
||||||
|
verbose_name = _("Description")
|
||||||
|
verbose_name_plural = _("Descriptions")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class DescriptionTranslation(models.Model):
|
||||||
|
translation_id = models.AutoField(primary_key=True)
|
||||||
|
description = models.ForeignKey(Description, on_delete=models.CASCADE)
|
||||||
|
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
|
||||||
|
description_translation = RichTextField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'description_translation'
|
||||||
|
verbose_name = _("Translation")
|
||||||
|
verbose_name_plural = _("Translations")
|
@ -1,5 +1,4 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.forms import JSONField, fields
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from ckeditor.fields import RichTextField
|
from ckeditor.fields import RichTextField
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
BACKOFFICE_VERSION = 1.13
|
BACKOFFICE_VERSION = 1.14
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
BACKOFFICE_VERSION = 1.13
|
BACKOFFICE_VERSION = 1.14
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
django==3.2
|
django==3.2
|
||||||
django-ckeditor==6.0.0
|
django-ckeditor==6.0.0
|
||||||
django_admin_json_editor=0.2.3
|
django_admin_json_editor==0.2.3
|
||||||
asgiref==3.3.4
|
asgiref==3.3.4
|
||||||
certifi==2020.6.20
|
certifi==2020.6.20
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
|
Loading…
Reference in New Issue
Block a user