From 168561bc559fdfd0da6122925887feb63da81753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 18 Jan 2019 17:58:45 +0100 Subject: [PATCH] Added gender field for users. --- CHANGELOG.rst | 1 + openslides/users/access_permissions.py | 3 ++- openslides/users/migrations/0008_user_gender.py | 16 ++++++++++++++++ openslides/users/models.py | 2 ++ openslides/users/serializers.py | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 openslides/users/migrations/0008_user_gender.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c10d3e073..4ab7c1459 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -36,6 +36,7 @@ Motions: User: - Added new admin group which grants all permissions. Users of existing group 'Admin' or 'Staff' are move to the new group during migration [#3859]. + - Added gender field [#4124]. Version 2.3 (2018-09-20) diff --git a/openslides/users/access_permissions.py b/openslides/users/access_permissions.py index 40843611e..379312f2f 100644 --- a/openslides/users/access_permissions.py +++ b/openslides/users/access_permissions.py @@ -33,7 +33,8 @@ class UserAccessPermissions(BaseAccessPermissions): # * full data i. e. all fields (including session_auth_hash), # * all data i. e. all fields but not session_auth_hash, # * many data i. e. all fields but not the default password and session_auth_hash, - # * little data i. e. all fields but not the default password, session_auth_hash, comments and active status, + # * little data i. e. all fields but not the default password, session_auth_hash, + # comments, gender, email, last_email_send and active status, # * no data. # Prepare field set for users with "all" data, "many" data and with "little" data. diff --git a/openslides/users/migrations/0008_user_gender.py b/openslides/users/migrations/0008_user_gender.py new file mode 100644 index 000000000..028c666ac --- /dev/null +++ b/openslides/users/migrations/0008_user_gender.py @@ -0,0 +1,16 @@ +# Generated by Django 2.1.5 on 2019-01-18 16:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [("users", "0007_superadmin")] + + operations = [ + migrations.AddField( + model_name="user", + name="gender", + field=models.CharField(blank=True, max_length=255), + ) + ] diff --git a/openslides/users/models.py b/openslides/users/models.py index 0af1fdf5a..e37b8ab11 100644 --- a/openslides/users/models.py +++ b/openslides/users/models.py @@ -134,6 +134,8 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser): last_name = models.CharField(max_length=255, blank=True) + gender = models.CharField(max_length=255, blank=True) + email = models.EmailField(blank=True) last_email_send = models.DateTimeField(blank=True, null=True) diff --git a/openslides/users/serializers.py b/openslides/users/serializers.py index 38a9914a8..b0b00cb27 100644 --- a/openslides/users/serializers.py +++ b/openslides/users/serializers.py @@ -29,6 +29,7 @@ USERCANSEESERIALIZER_FIELDS = ( USERCANSEEEXTRASERIALIZER_FIELDS = USERCANSEESERIALIZER_FIELDS + ( + "gender", "email", "last_email_send", "comment",