From b3444772fc9c9ac74992c97fb262d48424150e37 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Tue, 19 Jun 2018 06:27:19 -0400 Subject: [PATCH] Add forms object for new preferences --- brutaldon/forms.py | 2 ++ .../migrations/0008_auto_20180618_2140.py | 18 ++++++++++++++++++ brutaldon/models.py | 5 ++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 brutaldon/migrations/0008_auto_20180618_2140.py diff --git a/brutaldon/forms.py b/brutaldon/forms.py index 8f96ab4..62b9fbd 100644 --- a/brutaldon/forms.py +++ b/brutaldon/forms.py @@ -1,6 +1,8 @@ from django import forms from django.conf import settings from pytz import common_timezones +from .models import Theme + PRIVACY_CHOICES = (('public', 'Public'), ('unlisted', 'Unlisted'), diff --git a/brutaldon/migrations/0008_auto_20180618_2140.py b/brutaldon/migrations/0008_auto_20180618_2140.py new file mode 100644 index 0000000..16f1b2b --- /dev/null +++ b/brutaldon/migrations/0008_auto_20180618_2140.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.6 on 2018-06-19 01:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('brutaldon', '0007_auto_20180618_2115'), + ] + + operations = [ + migrations.AlterField( + model_name='theme', + name='name', + field=models.TextField(max_length=80, unique=True), + ), + ] diff --git a/brutaldon/models.py b/brutaldon/models.py index 6b8e6ea..ee45f64 100644 --- a/brutaldon/models.py +++ b/brutaldon/models.py @@ -11,12 +11,15 @@ class Client(models.Model): return self.name + ": " + self.api_base_id class Theme(models.Model): - name = models.TextField(max_length=80) + name = models.TextField(max_length=80, unique=True) 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) + def __str__(self): + return self.name + class Preference(models.Model): theme = models.ForeignKey(Theme, models.SET_NULL, null=True) data_saver = models.BooleanField(default=False)