Log in

Get gravatar for notifications

  • 1
  • 15 Apr '16

Hi, is it possible to get the Gravatars for notification area for example below gets the avatar for the user but how to get the avatar for the comment user?

commentTxt: "{% trans "{user} has commented on {topic}" %}" + "<a href='#' class='avatar'> <img class='avatar-img thumbnail' src='{% get_gravatar_url **user=user** size=50 %}'/></a>",'
nitelyEsteban Castro Borsani
  • 2
  • 15 Apr '16

Not with a templatetag, no. The notifications are retrieve from the server through AJAX, so that endpoint would have to send the image url (or id) within the json. So, you would have to modify the notification view (to send the avatar, I think you can call the templatetag as a regular function) and the notification js/coffesript (to display the image), then re-compile all the js.

  • 29 Apr '16

Thanks a lot @nitely, I will try that.

Reply