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. Gravatar support for Django comments by jonathan 3 years, 4 months ago
  2. Full Featured Gravatar Tag by ashcrow 3 years, 1 month ago
  3. Prefill ForeignKey caches by insin 3 years, 4 months ago
  4. Improved User Admin by gregb 1 year, 9 months ago
  5. Authenticate with Email Address by thom 4 years, 10 months ago

Comments

(Forgotten your password?)