2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

Theme change works but applies to all user

This commit is contained in:
eeintech
2020-09-07 15:15:51 -05:00
parent 0548bee8ad
commit 2e5ec5d249
7 changed files with 65 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 3.0.7 on 2020-09-07 16:12
# Generated by Django 3.0.7 on 2020-09-07 20:12
from django.db import migrations, models
@ -14,7 +14,7 @@ class Migration(migrations.Migration):
name='Theme',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('theme', models.IntegerField(choices=[(0, 'Default'), (1, 'Darker')], default=0)),
('theme', models.CharField(blank=True, choices=[('', 'Default'), ('-darker', 'Darker')], default='', max_length=20)),
],
),
]

View File

@ -159,12 +159,12 @@ class Currency(models.Model):
class Theme(models.Model):
""" Color Theme setting """
class ThemeChoices(models.IntegerChoices):
DEFAULT = 0, _('Default')
DARKER = 1, _('Darker')
class ThemeChoices(models.TextChoices):
DEFAULT = '', _('Default')
DARKER = '-darker', _('Darker')
theme = models.IntegerField(choices=ThemeChoices.choices,
default=ThemeChoices.DEFAULT)
theme = models.CharField(max_length=20,
choices=ThemeChoices.choices,
default=ThemeChoices.DEFAULT,
blank=True)
def __str__(self):
return self.theme