BO 1.22 training_plan_day
This commit is contained in:
parent
f09e2224b9
commit
ffbfe4c877
@ -11,3 +11,4 @@ from .description import DescriptionAdmin
|
|||||||
from .training_plan import TrainingPlanAdmin, TrainingPlanDetailAdmin
|
from .training_plan import TrainingPlanAdmin, TrainingPlanDetailAdmin
|
||||||
from .faq import FaqAdmin
|
from .faq import FaqAdmin
|
||||||
from .split_tests import SplitTestAdmin
|
from .split_tests import SplitTestAdmin
|
||||||
|
from .training_plan_day import TrainingPlanDayAdmin
|
||||||
|
@ -58,7 +58,6 @@ class TrainingPlanDetailAdmin(admin.ModelAdmin):
|
|||||||
new_sort = details[len(details) - 1].sort + 1
|
new_sort = details[len(details) - 1].sort + 1
|
||||||
|
|
||||||
for objectAttr in queryset:
|
for objectAttr in queryset:
|
||||||
|
|
||||||
objectAttr.pk = None
|
objectAttr.pk = None
|
||||||
objectAttr.sort = new_sort
|
objectAttr.sort = new_sort
|
||||||
objectAttr.save()
|
objectAttr.save()
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from ..models.training_plan_day import TrainingPlanDay, TrainingPlanDayTranslation
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanDayTranslationInline(admin.TabularInline):
|
||||||
|
model = TrainingPlanDayTranslation
|
||||||
|
fields = ('language_code', 'name_translation')
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanDayAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name',)
|
||||||
|
fields = ('name',)
|
||||||
|
|
||||||
|
inlines = [
|
||||||
|
TrainingPlanDayTranslationInline,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(TrainingPlanDay, TrainingPlanDayAdmin)
|
||||||
|
admin.autodiscover()
|
@ -14,3 +14,4 @@ from .description import Description, DescriptionTranslation
|
|||||||
from .training_plan import TrainingPlan, TrainingPlanDetail
|
from .training_plan import TrainingPlan, TrainingPlanDetail
|
||||||
from .faq import Faq, FaqTranslation
|
from .faq import Faq, FaqTranslation
|
||||||
from .split_tests import SplitTests
|
from .split_tests import SplitTests
|
||||||
|
from .training_plan_day import TrainingPlanDay, TrainingPlanDayTranslation
|
||||||
|
@ -4,6 +4,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from .enums import LanguageTypes
|
from .enums import LanguageTypes
|
||||||
from ..models import ExerciseType, ExerciseTree
|
from ..models import ExerciseType, ExerciseTree
|
||||||
|
from ..models.training_plan_day import TrainingPlanDay
|
||||||
|
|
||||||
|
|
||||||
class TrainingPlan(models.Model):
|
class TrainingPlan(models.Model):
|
||||||
@ -36,7 +37,7 @@ class TrainingPlanDetail(models.Model):
|
|||||||
weight = models.IntegerField(blank=True)
|
weight = models.IntegerField(blank=True)
|
||||||
resting_time = models.IntegerField(blank=True)
|
resting_time = models.IntegerField(blank=True)
|
||||||
parallel = models.BooleanField(blank=True)
|
parallel = models.BooleanField(blank=True)
|
||||||
day = models.CharField(max_length=50, blank=True)
|
day = models.ForeignKey(TrainingPlanDay, on_delete=models.CASCADE, blank=True,null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'training_plan_detail'
|
db_table = 'training_plan_detail'
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from ckeditor.fields import RichTextField
|
||||||
|
|
||||||
|
from .enums import LanguageTypes
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanDay(models.Model):
|
||||||
|
day_id = models.AutoField(primary_key=True)
|
||||||
|
name = models.CharField(max_length=200, help_text='Unique description name',
|
||||||
|
verbose_name=_("name"))
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'training_plan_day'
|
||||||
|
verbose_name = _("Training Day")
|
||||||
|
verbose_name_plural = _("Training Days")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanDayTranslation(models.Model):
|
||||||
|
translation_id = models.AutoField(primary_key=True)
|
||||||
|
day = models.ForeignKey(TrainingPlanDay, on_delete=models.CASCADE)
|
||||||
|
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
|
||||||
|
name_translation = models.CharField(max_length=200, help_text='Unique description name',
|
||||||
|
verbose_name=_("name"))
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'training_plan_day_translation'
|
||||||
|
verbose_name = _("Translation")
|
||||||
|
verbose_name_plural = _("Translations")
|
@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
BACKOFFICE_VERSION = 1.21
|
BACKOFFICE_VERSION = 1.22
|
||||||
|
|
||||||
# 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.21
|
BACKOFFICE_VERSION = 1.22
|
||||||
|
|
||||||
# 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__)))
|
||||||
|
Loading…
Reference in New Issue
Block a user