BO 1.17 split_tests, training_plan.tree_id

This commit is contained in:
Bossanyi Tibor
2021-05-18 22:45:21 +02:00
parent cc086325fb
commit 1812fc4d52
8 changed files with 149 additions and 7 deletions
@@ -10,3 +10,4 @@ from .exercise_plan import ExercisePlanAdmin
from .description import DescriptionAdmin
from .training_plan import TrainingPlanAdmin, TrainingPlanDetailAdmin
from .faq import FaqAdmin
from .split_tests import SplitTestAdmin
@@ -0,0 +1,12 @@
from django.contrib import admin
from ..models.split_tests import SplitTests
class SplitTestAdmin(admin.ModelAdmin):
list_display = ('test_id', 'name','remote_config_key', 'remote_config_value', 'test_value', 'active', 'valid_to')
list_editable = ('name','remote_config_key', 'remote_config_value', 'test_value', 'active', 'valid_to')
admin.site.register(SplitTests, SplitTestAdmin)
admin.autodiscover()
@@ -13,7 +13,7 @@ class TranslationTrainingPlanInline(admin.TabularInline):
class TrainingPlanAdmin(admin.ModelAdmin):
list_display = ('training_plan_id', 'name','internal_name', 'free')
fields = ('name','description')
fields = ('tree', 'name','description', 'internal_name', 'free')
list_editable = ('name','internal_name', 'free')
inlines = [
@@ -13,3 +13,4 @@ from .evaluation import Evaluation, EvaluationAttribute
from .description import Description, DescriptionTranslation
from .training_plan import TrainingPlan, TrainingPlanDetail
from .faq import Faq, FaqTranslation
from .split_tests import SplitTests
@@ -1,12 +1,13 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .enums import LanguageTypes
from ckeditor.fields import RichTextField
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 '
description = RichTextField(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)
@@ -28,7 +29,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)
description = RichTextField(max_length=1000, blank=True, null=True)
class Meta:
db_table = 'exercise_tree_translation'
@@ -0,0 +1,20 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
class SplitTests(models.Model):
test_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=50, help_text='Unique test name',
verbose_name=_("name"))
remote_config_key = models.CharField(max_length=50, blank=True)
remote_config_value = models.CharField(max_length=50, blank=True)
test_value = models.CharField(max_length=50, blank=True)
active = models.BooleanField()
valid_to = models.DateTimeField(blank=True)
class Meta:
db_table = 'split_tests'
verbose_name = _("A/B Test")
verbose_name_plural = _("A/B Tests")
def __str__(self):
return self.name
@@ -3,11 +3,12 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
from .enums import LanguageTypes
from ..models import ExerciseType
from ..models import ExerciseType, ExerciseTree
class TrainingPlan(models.Model):
training_plan_id = models.AutoField(primary_key=True)
tree = models.ForeignKey(ExerciseTree,on_delete=models.CASCADE)
name = models.CharField(max_length=100, help_text='The name of the training plan',
verbose_name=_("name"))
description = RichTextField(blank=True, null=True)