ExerciseType base

This commit is contained in:
Bossanyi Tibor 2020-08-19 09:19:49 +02:00
parent 6b82bdbf59
commit 102f7ba703
2 changed files with 6 additions and 2 deletions

View File

@ -33,12 +33,15 @@ class TranslationInline(admin.TabularInline):
class ExerciseTypeAdmin(admin.ModelAdmin):
list_display = ('exercise_type_id', 'tree', 'name_colored', 'active')
list_display = ('exercise_type_id', 'tree', 'name_colored', 'active', 'base')
search_fields = ['name']
def name_colored(self, obj):
if obj.active:
color_code = '7bc863'
if obj.base:
color_code = '7bc863'
else:
color_code = '4178bc'
else:
color_code = 'C20000'
html = '<span style="color: #{};">{}</span>˓→'.format(color_code, obj.name)

View File

@ -39,6 +39,7 @@ class ExerciseType(models.Model):
unit_quantity_unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.KG, max_length=50, blank=True,
null=True)
active = models.BooleanField(default=0, blank=True, null=True)
base = models.BooleanField(default=0, blank=True, null=True)
class Meta:
db_table = 'exercise_type'