Add forms object for new preferences

This commit is contained in:
Jason McBrayer 2018-06-19 06:27:19 -04:00
parent cbb5b544ed
commit b3444772fc
3 changed files with 24 additions and 1 deletions

View File

@ -1,6 +1,8 @@
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from pytz import common_timezones from pytz import common_timezones
from .models import Theme
PRIVACY_CHOICES = (('public', 'Public'), PRIVACY_CHOICES = (('public', 'Public'),
('unlisted', 'Unlisted'), ('unlisted', 'Unlisted'),

View File

@ -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),
),
]

View File

@ -11,12 +11,15 @@ class Client(models.Model):
return self.name + ": " + self.api_base_id return self.name + ": " + self.api_base_id
class Theme(models.Model): 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, main_css = models.TextField(max_length=1024, blank=True, null=True,
default="css/fullbrutalism.css") default="css/fullbrutalism.css")
tweaks_css = models.TextField(max_length=1024, blank=True, null=True) tweaks_css = models.TextField(max_length=1024, blank=True, null=True)
is_brutalist = models.BooleanField(default=False) is_brutalist = models.BooleanField(default=False)
def __str__(self):
return self.name
class Preference(models.Model): class Preference(models.Model):
theme = models.ForeignKey(Theme, models.SET_NULL, null=True) theme = models.ForeignKey(Theme, models.SET_NULL, null=True)
data_saver = models.BooleanField(default=False) data_saver = models.BooleanField(default=False)