Add theme field to User
parent
4163d42163
commit
f2d9eb6326
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0010_auto_20150414_0936'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='user',
|
||||||
|
name='theme',
|
||||||
|
field=models.CharField(null=True, blank=True, max_length=100, default='', verbose_name='default theme'),
|
||||||
|
preserve_default=True,
|
||||||
|
),
|
||||||
|
]
|
|
@ -118,6 +118,8 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||||
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
|
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
|
||||||
lang = models.CharField(max_length=20, null=True, blank=True, default="",
|
lang = models.CharField(max_length=20, null=True, blank=True, default="",
|
||||||
verbose_name=_("default language"))
|
verbose_name=_("default language"))
|
||||||
|
theme = models.CharField(max_length=100, null=True, blank=True, default="",
|
||||||
|
verbose_name=_("default theme"))
|
||||||
timezone = models.CharField(max_length=20, null=True, blank=True, default="",
|
timezone = models.CharField(max_length=20, null=True, blank=True, default="",
|
||||||
verbose_name=_("default timezone"))
|
verbose_name=_("default timezone"))
|
||||||
colorize_tags = models.BooleanField(null=False, blank=True, default=False,
|
colorize_tags = models.BooleanField(null=False, blank=True, default=False,
|
||||||
|
@ -167,6 +169,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||||
self.color = ""
|
self.color = ""
|
||||||
self.bio = ""
|
self.bio = ""
|
||||||
self.lang = ""
|
self.lang = ""
|
||||||
|
self.theme = ""
|
||||||
self.timezone = ""
|
self.timezone = ""
|
||||||
self.colorize_tags = True
|
self.colorize_tags = True
|
||||||
self.token = None
|
self.token = None
|
||||||
|
|
|
@ -49,7 +49,7 @@ class UserSerializer(serializers.ModelSerializer):
|
||||||
# IMPORTANT: Maintain the UserAdminSerializer Meta up to date
|
# IMPORTANT: Maintain the UserAdminSerializer Meta up to date
|
||||||
# with this info (including there the email)
|
# with this info (including there the email)
|
||||||
fields = ("id", "username", "full_name", "full_name_display",
|
fields = ("id", "username", "full_name", "full_name_display",
|
||||||
"color", "bio", "lang", "timezone", "is_active",
|
"color", "bio", "lang", "theme", "timezone", "is_active",
|
||||||
"photo", "big_photo", "roles", "projects_with_me")
|
"photo", "big_photo", "roles", "projects_with_me")
|
||||||
read_only_fields = ("id",)
|
read_only_fields = ("id",)
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class UserAdminSerializer(UserSerializer):
|
||||||
# IMPORTANT: Maintain the UserSerializer Meta up to date
|
# IMPORTANT: Maintain the UserSerializer Meta up to date
|
||||||
# with this info (including here the email)
|
# with this info (including here the email)
|
||||||
fields = ("id", "username", "full_name", "full_name_display", "email",
|
fields = ("id", "username", "full_name", "full_name_display", "email",
|
||||||
"color", "bio", "lang", "timezone", "is_active", "photo",
|
"color", "bio", "lang", "theme", "timezone", "is_active", "photo",
|
||||||
"big_photo")
|
"big_photo")
|
||||||
read_only_fields = ("id", "email")
|
read_only_fields = ("id", "email")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue