BO 1.7 Exercise Tree description

This commit is contained in:
Bossanyi Tibor 2021-03-10 20:46:35 +01:00
parent 693893eee4
commit a16de5c7cd
4 changed files with 9 additions and 2 deletions

View File

@ -26,7 +26,7 @@ from .models import ExercisePlanTemplate, ExercisePlanTemplateTranslation, Exerc
class TranslationTreeInline(admin.TabularInline):
model = ExerciseTreeTranslation
fields = ('language_code', 'name',)
fields = ('language_code', 'name', 'description')
extra = 0
@ -53,7 +53,7 @@ class ExerciseTreeAdmin(admin.ModelAdmin):
list_display = ('tree_id', 'name_colored', 'active')
search_fields = ['name']
fields = ["name", "image_url", "active", "get_image_preview"]
fields = ["name", 'description', "image_url", "active", "get_image_preview"]
readonly_fields = ("get_image_preview",)
def get_image_preview(self, obj):

View File

@ -77,6 +77,8 @@ class ExerciseDeviceTranslation(models.Model):
class ExerciseTree(models.Model):
tree_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100, help_text='The name should be in English here')
description = models.TextField(max_length=1000, blank=True, null=True, help_text='The description should be in '
'English here')
image_url = models.ImageField(upload_to='images/', help_text='The menu image size is 1366x768')
active = models.BooleanField(default=0, blank=True, null=True)
@ -95,6 +97,7 @@ class ExerciseTreeTranslation(models.Model):
tree = models.ForeignKey(ExerciseTree, on_delete=models.CASCADE)
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
name = models.CharField(max_length=100)
description = models.TextField(max_length=1000, blank=True, null=True)
class Meta:
db_table = 'exercise_tree_translation'

View File

@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
import os
BACKOFFICE_VERSION = 1.7
# 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 = Path(__file__).resolve().parent.parent.parent

View File

@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
import os
BACKOFFICE_VERSION = 1.7
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))