Compare commits
No commits in common. "74dacaba2c65ecb4f694ce5a40446d162415677d" and "a96cede14f26366cf434eba9ea1a40f95521fab0" have entirely different histories.
74dacaba2c
...
a96cede14f
|
|
@ -10,8 +10,8 @@ def get_active_theme(request):
|
||||||
obj = objs_manager.first()
|
obj = objs_manager.first()
|
||||||
if obj:
|
if obj:
|
||||||
obj.set_active()
|
obj.set_active()
|
||||||
# else:
|
else:
|
||||||
# obj = objs_manager.create()
|
obj = objs_manager.create()
|
||||||
|
|
||||||
elif objs_active_count == 1:
|
elif objs_active_count == 1:
|
||||||
obj = objs_active_ls[0]
|
obj = objs_active_ls[0]
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
# Generated by Django 4.0.3 on 2022-10-25 13:59
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
from django.db import transaction, connection
|
|
||||||
|
|
||||||
def forward(apps, schema_editor):
|
|
||||||
Theme = apps.get_model("admin_interface", "Theme")
|
|
||||||
if len(Theme.objects.all()) == 1 and Theme.objects.first().name == 'Django':
|
|
||||||
with transaction.atomic():
|
|
||||||
cursor = connection.cursor()
|
|
||||||
cursor.execute("""truncate table "admin_interface_theme" restart identity;""")
|
|
||||||
|
|
||||||
def reverse(apps, schema_editor):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('admin_interface', '0028_alter_theme_demo'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(forward, reverse),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='usertheme',
|
|
||||||
name='user',
|
|
||||||
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -20,8 +20,8 @@ class UserTheme(models.Model):
|
||||||
verbose_name = 'Users theme'
|
verbose_name = 'Users theme'
|
||||||
verbose_name_plural = 'Users themes'
|
verbose_name_plural = 'Users themes'
|
||||||
|
|
||||||
user = models.OneToOneField(
|
user = models.ForeignKey(
|
||||||
'auth.User', on_delete=models.CASCADE, null=True)
|
'auth.User', on_delete=models.CASCADE, null=True, unique=True)
|
||||||
theme = models.ForeignKey('Theme', on_delete=models.CASCADE)
|
theme = models.ForeignKey('Theme', on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -65,8 +65,8 @@ class Theme(models.Model):
|
||||||
obj = objs_manager.all().first()
|
obj = objs_manager.all().first()
|
||||||
if obj:
|
if obj:
|
||||||
obj.set_active()
|
obj.set_active()
|
||||||
# else:
|
else:
|
||||||
# obj = objs_manager.create()
|
obj = objs_manager.create()
|
||||||
|
|
||||||
elif objs_active_count == 1:
|
elif objs_active_count == 1:
|
||||||
obj = objs_active_ls[0]
|
obj = objs_active_ls[0]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__version__ = "0.19.4"
|
__version__ = "0.19.3"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue