django-simple-gravatar 1.0.0
Django Gravatar is a lightweight Django application that allows you to insert a Gravatar image in your templates.
Django Gravatar is a lightweight Django application that allows you to insert a Gravatar image in your templates.
Get it
The best way to install Django Gravatar is use easy_install.
easy_install django-simple-gravatar
If you prefer install it from source, grab the git repository from github and run setup.py
$ git clone git://github.com/skitoo/django-gravatar.git $ cd django-gravatar $ python setup.py install
Installation
Now Django Gravatar is in your PYTHONPATH. You can add this app in your project settings.py file.
INSTALLED_APPS = ( # other apps 'django_gravatar', )
You can specify a default image url, Gravatar will use it if it cannot find an account associated with the email parameter. In your settings project file add this variable
GRAVATAR_DEFAULT_URL = "http://www.example.com/mydefaultavatar.jpg"
Usage
Now you can use Django Gravatar tag in your templates. First import template tag.
{% load gravatar %}
Django Gravatar offers you two tags. The first one return gravatar image url.
{% gravatar_url user.email %}
# you can pass an optional argument to specify the avatar size. By default size is 80.
{% gravatar_url user.email 40 %}
The second one return an HTML img tag.
{% gravatar user.email %}
# you can also pass an optional size argument here.
{% gravatar user.email 40 %}
# this tag provides another argument to specify <img /> arguments.
{% gravatar user.email 40 'class="gravatar"' %}
Credits
Alexis Couronne <alexis.couronne@scopart.fr>
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| django_simple_gravatar-1.0.0-py2.7.egg (md5) | Python Egg | 2.7 | 2011-12-15 | 4KB | 190 |
- Author: Alexis Couronne
- Home Page: https://github.com/skitoo/django-gravatar
- Keywords: django gravatar avatar
- License: New BSD License
- Platform: OS Independent
-
Categories
- Development Status :: 5 - Production/Stable
- Environment :: Web Environment
- Framework :: Django
- Intended Audience :: Developers
- License :: OSI Approved :: BSD License
- Operating System :: OS Independent
- Programming Language :: Python
- Topic :: Internet :: WWW/HTTP :: Dynamic Content
- Topic :: Software Development
- Topic :: Software Development :: Libraries :: Application Frameworks
- Package Index Owner: Alexis.Couronne
- DOAP record: django-simple-gravatar-1.0.0.xml
