django-gravatar2 1.3.0

Essential Gravatar support for Django. Features helper methods, templatetags and a full test suite!

A lightweight django-gravatar app. Includes helper methods for interacting with gravatars outside of template code.

If you like this library and it's saved you some time, please consider supporting further development with a Gittip donation!

Features

  • Helper methods for constructing a gravatar url and checking an email for an existing gravatar
  • Templatetags for generating a gravatar url or gravatar <img> tag.
  • Full test suite!

Installing

Install from PyPi:

You can pip install the app directly from GitHub:

$ pip install git+git://github.com/twaddington/django-gravatar.git#egg=DjangoGravatar

Alternatively, you can now install directly from PyPi!

$ pip install django-gravatar2

Make sure you install django-gravatar2 as there are several other incompatible django-gravatar libraries available.

Add django_gravatar to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    # ...
    'django_gravatar',
)

Basic Usage

Use in code:

from django_gravatar.helpers import get_gravatar_url, has_gravatar, get_gravatar_profile_url, calculate_gravatar_hash

url = get_gravatar_url('alice@example.com', size=150)
gravatar_exists = has_gravatar('bob@example.com')
profile_url = get_gravatar_profile_url('alice@example.com')
email_hash = calculate_gravatar_hash('alice@example.com')

Use in templates:

{% load gravatar %}

{% gravatar_url user.email 150 %}
# https://secure.gravatar.com/avatar/hash.jpg?size=150

{% gravatar user.email 150 %}
# <img class="gravatar" src="https://secure.gravatar.com/avatar/hash.jpg?size=150" width="150" height="150" alt="" />

{% gravatar user.email 150 "user@example.com" %}
# <img class="gravatar" src="https://secure.gravatar.com/avatar/hash.jpg?size=150" width="150" height="150" alt="user@example.com" />

{% gravatar_profile_url user.email %}
# https://secure.gravatar.com/hash

Configuring

The following options can be configured in your settings.py:

GRAVATAR_URL # Gravatar base url. Defaults to 'http://www.gravatar.com/'

GRAVATAR_SECURE_URL # Gravatar base secure https url. Defaults to 'https://secure.gravatar.com/'

GRAVATAR_DEFAULT_SIZE # Gravatar size in pixels. Defaults to '80'

GRAVATAR_DEFAULT_IMAGE # An image url or one of the following: 'mm', 'identicon', 'monsterid', 'wavatar', 'retro'. Defaults to 'mm'

GRAVATAR_DEFAULT_RATING # One of the following: 'g', 'pg', 'r', 'x'. Defaults to 'g'

GRAVATAR_DEFAULT_SECURE # True to use https by default, False for plain http. Defaults to True

Contributing

Feel free to fork django-gravatar on GitHub! We'd love to see your pull requests. Please make sure you run tests before submitting a patch.

Copyright (c) 2013 Tristan Waddington <tristan.waddington@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Author

Tristan Waddington

Pip

django-gravatar2==1.3.0

Classifiers

  • Development Status :: 5 - Production/Stable
  • Environment :: Web Environment
  • Framework :: Django
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 2.6
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 3.2
  • Programming Language :: Python :: 3.3
File Type Python Version Uploaded On Downloads
django_gravatar2-1.3.0-py2.py3-none-any.whl Wheel 2.7 April 7, 2015 4,279
django-gravatar2-1.3.0.tar.gz Source April 7, 2015 1,865
Version Release Date
1.3.0 April 7, 2015
1.2.1 Feb. 3, 2015
1.1.4 March 31, 2014
1.1.3 Sept. 4, 2013
1.1.1 Sept. 4, 2013
1.0.6 July 5, 2012
1.0.5 July 4, 2012
1.0.4 May 25, 2012
1.0.3 May 19, 2012
1.0.2 May 18, 2012
1.0.1 Jan. 26, 2012
1.0.0 Jan. 26, 2012
Date Package Version Action
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.1 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.2 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.2.1 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.3.0 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.1.3 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.3 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.4 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.1.4 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.0 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.6 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.0.5 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 1.1.1 Release Created
Aug. 26, 2015, 12:13 a.m. django-gravatar2 Package Created