On Thursday 22 December 2016 17:45:56 skerdi wrote:
> That get_photo func, I'm not using it. It tried to do something and I
> forgot to delete it.
Try this on the Profile model:
def get_photo_url(self, user, when_following=True):
if when_following:
try:
if self.following.get(user=user).count() > 0:
return user.profile.photo.url
return None
except user.ObjectDoesNotExist:
return None
else:
return user.profile.photo
--
Melvyn Sopacua
No comments:
Post a Comment