Jump to >

djblets.gravatars.templatetags.gravatars

gravatar(user, size=None)[source]

Return HTML for displaying a user’s Gravatar.

This is also influenced by the following Django settings:

GRAVATAR_SIZE:
The default size for Gravatars.
GRAVATAR_RATING:
The maximum allowed rating (one of 'g', 'pg', 'r', or 'x').
GRAVATAR_DEFAULT:
The default image to show if the user hasn’t specified a Gravatar (one of identicon, monsterid, or wavatar).

See https://gravatar.com for more information.

Note that callers adhering to the GDPR should check for a user’s consent before displaying a Gravatar on their behalf. This is checked automatically if using djblets.avatars.

Parameters:
  • user (django.contrib.auth.models.User) – The user whose gravatar is to be displayed.
  • size (int) – An optional height and width for the image (in pixels). This will default to 80 if not specified.
Returns:

HTML for rendering the Gravatar.

Return type:

django.utils.safestring.SafeText

gravatar_url(email, size=None)[source]

Return a Gravatar URL for an e-mail address.

This is also influenced by the following Django settings:

GRAVATAR_SIZE:
The default size for Gravatars.
GRAVATAR_RATING:
The maximum allowed rating (one of 'g', 'pg', 'r', or 'x').
GRAVATAR_DEFAULT:
The default image to show if the user hasn’t specified a Gravatar (one of identicon, monsterid, or wavatar).

See https://gravatar.com for more information.

Note that callers adhering to the GDPR should check for a user’s consent before displaying a Gravatar on their behalf. This is checked automatically if using djblets.avatars.

Parameters:
  • email (unicode) – The e-mail address.
  • size (int) – An optional height and width of the image (in pixels). This will default to 80 if not specified.
Returns:

HTML for rendering the Gravatar.

Return type:

django.utils.safestring.SafeText