Skip to content

Commit

Permalink
[Hardening] Favourite model _unicode resilient to None
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani committed Sep 23, 2019
1 parent cf9154d commit 4d31e91
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions geonode/favorite/models.py
Expand Up @@ -111,5 +111,8 @@ class Meta:
unique_together = (('user', 'content_type', 'object_id'),)

def __unicode__(self):
return "Favorite: {}, {}, {}".format(
self.content_object.title, self.content_type, self.user)
if self.content_object:
return "Favorite: {}, {}, {}".format(
self.content_object.title, self.content_type, self.user)
else:
return "Unknown"

0 comments on commit 4d31e91

Please sign in to comment.