Merge pull request #652 from taigaio/luyikei-avoid-none
Avoid accessing an attribute of a NoneType objectremotes/origin/issue/4795/notification_even_they_are_disabled
commit
cc4f82f7cd
|
@ -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