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')