user增加type,同时更新信号

This commit is contained in:
曹前明 2022-09-07 18:36:25 +08:00
parent 822a41cef5
commit 0c996a3c59
2 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@ def updateEmployee(sender, instance, created, **kwargs):
if not ep_created:
ep.belong_dept = instance.belong_dept
ep.post = instance.post
ep.type = instance.type
if instance.phone != ep.phone:
ep.phone = instance.phone
ep.save()

View File

@ -313,7 +313,7 @@ class UserUpdateSerializer(CustomModelSerializer):
class Meta:
model = User
fields = ['username', 'name', 'avatar', 'is_active', 'phone']
fields = ['username', 'name', 'avatar', 'is_active', 'phone', 'type']
def update(self, instance, validated_data):
if User.objects.filter(username=validated_data['username']
@ -331,7 +331,7 @@ class UserCreateSerializer(CustomModelSerializer):
class Meta:
model = User
fields = ['username', 'name', 'avatar', 'is_active', 'phone']
fields = ['username', 'name', 'avatar', 'is_active', 'phone', 'type']
class PasswordChangeSerializer(serializers.Serializer):