修复:修改人不会在修改后改变问题

pull/66/head
李强 2022-08-13 23:43:05 +08:00
parent f2fcee28de
commit 8754bbc30b
1 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,9 @@ class CustomModelSerializer(DynamicFieldsMixin, ModelSerializer):
def update(self, instance, validated_data):
if self.request:
if str(self.request.user) != "AnonymousUser":
if self.modifier_field_id in self.fields.fields:
validated_data[self.modifier_field_id] = self.get_request_user_id()
if hasattr(self.instance, self.modifier_field_id):
setattr(
self.instance, self.modifier_field_id, self.get_request_user_id()