Add user new terms modifications
parent
29daac11df
commit
ebb6dfc3c3
|
@ -118,7 +118,7 @@ class UserAdmin(DjangoUserAdmin):
|
|||
(None, {"fields": ("username", "password")}),
|
||||
(_("Personal info"), {"fields": ("full_name", "email", "bio", "photo")}),
|
||||
(_("Extra info"), {"fields": ("color", "lang", "timezone", "token", "colorize_tags",
|
||||
"email_token", "new_email")}),
|
||||
"email_token", "new_email", "accepted_terms", "read_new_terms")}),
|
||||
(_("Permissions"), {"fields": ("is_active", "is_superuser")}),
|
||||
(_("Restrictions"), {"fields": (("max_private_projects", "max_memberships_private_projects"),
|
||||
("max_public_projects", "max_memberships_public_projects"))}),
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2018-05-14 15:13
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0025_user_uuid'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='accepted_terms',
|
||||
field=models.BooleanField(default=True, verbose_name='accepted terms'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='read_new_terms',
|
||||
field=models.BooleanField(default=False, verbose_name='read new terms'),
|
||||
),
|
||||
]
|
|
@ -152,6 +152,8 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||
max_length=500, null=True, blank=True,
|
||||
verbose_name=_("photo"))
|
||||
date_joined = models.DateTimeField(_("date joined"), default=timezone.now)
|
||||
accepted_terms = models.BooleanField(_("accepted terms"), default=True)
|
||||
read_new_terms = models.BooleanField(_("new terms read"), default=False)
|
||||
lang = models.CharField(max_length=20, null=True, blank=True, default="",
|
||||
verbose_name=_("default language"))
|
||||
theme = models.CharField(max_length=100, null=True, blank=True, default="",
|
||||
|
|
|
@ -80,6 +80,8 @@ class UserAdminSerializer(UserSerializer):
|
|||
email = Field()
|
||||
uuid = Field()
|
||||
date_joined = Field()
|
||||
read_new_terms = Field()
|
||||
accepted_terms = Field()
|
||||
max_private_projects = Field()
|
||||
max_public_projects = Field()
|
||||
max_memberships_private_projects = Field()
|
||||
|
|
|
@ -64,8 +64,15 @@ class UserAdminValidator(UserValidator):
|
|||
# IMPORTANT: Maintain the UserSerializer Meta up to date
|
||||
# with this info (including here the email)
|
||||
fields = ("username", "full_name", "color", "bio", "lang",
|
||||
"theme", "timezone", "is_active", "email")
|
||||
"theme", "timezone", "is_active", "email", "read_new_terms")
|
||||
|
||||
def validate_read_new_terms(self, attrs, source):
|
||||
value = attrs[source]
|
||||
if not value:
|
||||
raise ValidationError(
|
||||
_("Read new terms has to be true'"))
|
||||
|
||||
return attrs
|
||||
|
||||
class RecoveryValidator(validators.Validator):
|
||||
token = serializers.CharField(max_length=200)
|
||||
|
|
Loading…
Reference in New Issue