# Generated by Django 3.2.12 on 2022-02-26 20:47 import django.core.validators from django.db import migrations, models import django.db.models.deletion def add_default_themes(apps, schema_editor): """add light and dark themes""" db_alias = schema_editor.connection.alias theme_model = apps.get_model("bookwyrm", "Theme") theme_model.objects.using(db_alias).create( name="BookWyrm Light", path="bookwyrm-light.scss", ) theme_model.objects.using(db_alias).create( name="BookWyrm Dark", path="bookwyrm-dark.scss", ) class Migration(migrations.Migration): dependencies = [ ("bookwyrm", "0141_alter_report_status"), ] operations = [ migrations.CreateModel( name="Theme", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("created_date", models.DateTimeField(auto_now_add=True)), ("name", models.CharField(max_length=50, unique=True)), ( "theme_file", models.FileField( null=True, upload_to="css/", validators=[ django.core.validators.FileExtensionValidator( ["scss", "sass"] ) ], ), ), ("path", models.CharField(blank=True, max_length=50, null=True)), ], ), migrations.AddField( model_name="sitesettings", name="default_theme", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to="bookwyrm.theme", ), ), migrations.AddField( model_name="user", name="theme", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to="bookwyrm.theme", ), ), migrations.RunPython( add_default_themes, reverse_code=migrations.RunPython.noop ), ]