From cd7946f3f015dd3f3f83b045f7cc4ca002dde02e Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 9 Apr 2020 18:58:22 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/api/admin_user.py | 15 +-------------- apps/users/serializers/user.py | 6 +++--- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/apps/assets/api/admin_user.py b/apps/assets/api/admin_user.py index c77da1ae4..3780def5e 100644 --- a/apps/assets/api/admin_user.py +++ b/apps/assets/api/admin_user.py @@ -1,17 +1,4 @@ -# ~*~ coding: utf-8 ~*~ -# Copyright (C) 2014-2018 Beijing DuiZhan Technology Co.,Ltd. All Rights Reserved. -# -# Licensed under the GNU General Public License v2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.gnu.org/licenses/gpl-2.0.html -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. + from django.db import transaction from django.db.models import Count diff --git a/apps/users/serializers/user.py b/apps/users/serializers/user.py index f4c2ee085..c961cccb4 100644 --- a/apps/users/serializers/user.py +++ b/apps/users/serializers/user.py @@ -30,7 +30,7 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer): (1, CUSTOM_PASSWORD) ) password_strategy = serializers.ChoiceField( - choices=PASSWORD_STRATEGY_CHOICES, required=True, initial=0, + choices=PASSWORD_STRATEGY_CHOICES, required=False, initial=0, label=_('Password strategy'), write_only=True ) @@ -62,9 +62,9 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer): def set_role_choices(self): role = self.fields['role'] - choices = role.choices + choices = role._choices choices.pop('App', None) - role.choices = choices + role._choices = choices def validate_role(self, value): request = self.context.get('request')