Avoid accessing an attribute of a NoneType object
parent
3c33c4e7cc
commit
8d4bd9d655
|
@ -239,7 +239,8 @@ class EditableWatchedResourceModelSerializer(WatchedResourceModelSerializer):
|
|||
|
||||
def to_native(self, obj):
|
||||
#if watchers wasn't attached via the get_queryset of the viewset we need to manually add it
|
||||
if obj is not None and not hasattr(obj, "watchers"):
|
||||
if obj is not None:
|
||||
if not hasattr(obj, "watchers"):
|
||||
obj.watchers = [user.id for user in obj.get_watchers()]
|
||||
|
||||
request = self.context.get("request", None)
|
||||
|
|
Loading…
Reference in New Issue