Setup for themes and related options
This commit is contained in:
parent
d2c8de991b
commit
6cbb2d10ed
|
@ -0,0 +1,42 @@
|
||||||
|
# Generated by Django 2.0.6 on 2018-06-19 01:03
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('brutaldon', '0004_auto_20180424_1424'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Preference',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data_saver', models.BooleanField(default=False)),
|
||||||
|
('fix_emojos', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Theme',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.TextField(max_length=80)),
|
||||||
|
('main_css', models.TextField(max_length=1024)),
|
||||||
|
('tweaks_css', models.TextField(blank=True, max_length=1024, null=True)),
|
||||||
|
('is_brutalist', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='preference',
|
||||||
|
name='theme',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='brutaldon.Theme'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='account',
|
||||||
|
name='preferences',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='brutaldon.Preference'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.0.6 on 2018-06-19 01:12
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('brutaldon', '0005_auto_20180618_2103'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='theme',
|
||||||
|
name='main_css',
|
||||||
|
field=models.TextField(blank=True, default='css/fullbrutalism.css', max_length=1024, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,38 @@
|
||||||
|
# Generated by Django 2.0.6 on 2018-06-19 01:03
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
def set_up_default_themes(apps, schema_editor):
|
||||||
|
Theme = apps.get_model('brutaldon', 'Theme')
|
||||||
|
default = Theme(name="default",
|
||||||
|
main_css="css/bulma.min.css",
|
||||||
|
tweaks_css="css/brutaldon.css",
|
||||||
|
is_brutalist=False)
|
||||||
|
default.save()
|
||||||
|
dark = Theme(name="default dark",
|
||||||
|
main_css="css/bulmaswatch-darkly-min.css",
|
||||||
|
tweaks_css="css/brutaldon-dark.css",
|
||||||
|
is_brutalist=False)
|
||||||
|
dark.save()
|
||||||
|
brutalism = Theme(name="FULLBRUTALISM",
|
||||||
|
main_css="css/fullbrutalism.css",
|
||||||
|
is_brutalist=True)
|
||||||
|
brutalism.save()
|
||||||
|
minimal = Theme(name="minimalist", main_css=None, is_brutalist=True)
|
||||||
|
minimal.save()
|
||||||
|
|
||||||
|
def delete_themes(apps, schema_editor):
|
||||||
|
Theme = apps.get_model('brutaldon' 'Theme')
|
||||||
|
for theme in Theme.objects.all():
|
||||||
|
theme.delete()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('brutaldon', '0006_auto_20180618_2112'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(set_up_default_themes, delete_themes)
|
||||||
|
]
|
|
@ -10,8 +10,22 @@ class Client(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name + ": " + self.api_base_id
|
return self.name + ": " + self.api_base_id
|
||||||
|
|
||||||
|
class Theme(models.Model):
|
||||||
|
name = models.TextField(max_length=80)
|
||||||
|
main_css = models.TextField(max_length=1024, blank=True, null=True,
|
||||||
|
default="css/fullbrutalism.css")
|
||||||
|
tweaks_css = models.TextField(max_length=1024, blank=True, null=True)
|
||||||
|
is_brutalist = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Preference(models.Model):
|
||||||
|
theme = models.ForeignKey(Theme, models.SET_NULL, null=True)
|
||||||
|
data_saver = models.BooleanField(default=False)
|
||||||
|
fix_emojos = models.BooleanField(default=False)
|
||||||
|
|
||||||
class Account(models.Model):
|
class Account(models.Model):
|
||||||
username = models.EmailField()
|
username = models.EmailField()
|
||||||
django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True)
|
django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True)
|
||||||
access_token = models.TextField(null=True, blank=True)
|
access_token = models.TextField(null=True, blank=True)
|
||||||
client= models.ForeignKey(Client, models.SET_NULL, null=True)
|
client= models.ForeignKey(Client, models.SET_NULL, null=True)
|
||||||
|
preferences = models.ForeignKey(Preference, models.SET_NULL, null=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue