|
|
|
@ -31,18 +31,15 @@ class ConnectionTokenSerializer(OrgResourceModelSerializerMixin):
|
|
|
|
|
'value': {'read_only': True},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def get_request_user(self):
|
|
|
|
|
def get_user(self, attrs):
|
|
|
|
|
request = self.context.get('request')
|
|
|
|
|
user = request.user if request else None
|
|
|
|
|
return user
|
|
|
|
|
|
|
|
|
|
def get_user(self, attrs):
|
|
|
|
|
return self.get_request_user()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SuperConnectionTokenSerializer(ConnectionTokenSerializer):
|
|
|
|
|
class Meta(ConnectionTokenSerializer.Meta):
|
|
|
|
|
pass
|
|
|
|
|
read_only_fields = list(set(ConnectionTokenSerializer.Meta.read_only_fields) - {'user'})
|
|
|
|
|
|
|
|
|
|
def get_user(self, attrs):
|
|
|
|
|
return attrs.get('user') or self.get_request_user()
|
|
|
|
|
return attrs.get('user')
|
|
|
|
|