Gravatar Images

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from django import template

import urllib, hashlib

register = template.Library()

def gravatar(user, size=80):
    gravatar_url = "http://www.gravatar.com/avatar.php?"
    gravatar_url += urllib.urlencode({
        'gravatar_id':hashlib.md5(user.email).hexdigest(),
        'size':str(size)})
    return """<img src="%s" alt="gravatar for %s" />""" % (gravatar_url, user.username)

register.simple_tag(gravatar)

More like this

  1. Full Featured Gravatar Tag by ashcrow 5 years, 4 months ago
  2. Gravatar support in model save override by JoeLinux 1 year, 1 month ago
  3. Gravatar support for Django comments by jonathan 5 years, 6 months ago
  4. Prefill ForeignKey caches by insin 5 years, 6 months ago
  5. sublist by nofactor 6 years, 4 months ago

Comments

(Forgotten your password?)