exercise_type menu_id

This commit is contained in:
Bossanyi Tibor 2020-07-19 14:44:46 +02:00
parent 35a3a9b0f9
commit fc4a56e369
2 changed files with 18 additions and 17 deletions

View File

@ -2,6 +2,22 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
class ExerciseTree(models.Model):
item_id = models.AutoField(primary_key=True)
parent_id = models.IntegerField(help_text='This is the parent menu ID. 0 if it is on the top of the tree')
name = models.CharField(max_length=100, help_text='The name 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)
class Meta:
db_table = 'exercise_tree'
verbose_name = _("Exercise Tree")
verbose_name_plural = _("Exercise Tree Items")
def __str__(self):
return self.name
class ExerciseType(models.Model):
class UnitTypes(models.TextChoices):
REPEAT = 'repeat'
@ -14,6 +30,7 @@ class ExerciseType(models.Model):
KG = 'kilogram'
exercise_type_id = models.AutoField(primary_key=True)
tree = models.ForeignKey(ExerciseTree, on_delete=models.CASCADE)
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')
@ -74,22 +91,6 @@ class ExerciseTypeTranslation(models.Model):
return self.name
class ExerciseTree(models.Model):
item_id = models.AutoField(primary_key=True)
parent_id = models.IntegerField(help_text='This is the parent menu ID. 0 if it is on the top of the tree')
name = models.CharField(max_length=100, help_text='The name 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)
class Meta:
db_table = 'exercise_tree'
verbose_name = _("Exercise Tree")
verbose_name_plural = _("Exercise Tree Items")
def __str__(self):
return self.name
class ExerciseTreeTranslation(models.Model):
translation_id = models.AutoField(primary_key=True)
tree = models.ForeignKey(ExerciseTree, on_delete=models.CASCADE)

View File

@ -74,7 +74,7 @@ WSGI_APPLICATION = 'aitrainer_backoffice.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'aitrainer2',
'NAME': 'aitrainer',
'USER': 'aitrainer',
'PASSWORD': 'andio2009',
'HOST': '127.0.0.1',