1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 07:52:23 +00:00

Do not call setattr with a constant attribute value

This commit is contained in:
Alexandre Iooss 2021-05-05 19:12:03 +02:00
parent 952c4383e7
commit 93bc6bb245
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02

View File

@ -74,7 +74,7 @@ class AliasViewSet(ReadProtectedModelViewSet):
serializer_class = self.serializer_class
if self.request.method in ['PUT', 'PATCH']:
# alias owner cannot be change once establish
setattr(serializer_class.Meta, 'read_only_fields', ('note',))
serializer_class.Meta.read_only_fields = ('note',)
return serializer_class
def destroy(self, request, *args, **kwargs):