A lightweight django-gravatar app. Includes helper methods for interacting with gravatars outside of template code.
A Note on Continued Support
Hey Folks, I haven’t actively maintained this project for some years now. Please let me know if there are security issues or regressions in basic functionality. I will do my best to address those. However, I don’t have the time to invest in other changes to the project. Additionally, I haven’t been involved in Django development in many years now. If you’re interested in adopting this project please shoot me a message.
—Tristan
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.
Run tests:
$> cd example_project $> ./manage.py test django_gravatar
Metadata
Release files for django-gravatar2 1.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_gravatar2-1.4.5.tar.gz | 10.4 kB | Without provenance | Details for django_gravatar2-1.4.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_gravatar2-1.4.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for django_gravatar2-1.4.5-py2.py3-none-any.whl |
Total release size: 18.6 kB
Release files / django_gravatar2-1.4.5.tar.gz
| Download URL | django_gravatar2-1.4.5.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2dbb56465e395dd8b3920d4017e27a4756912cc2ad9b11ba48cf143871a80364
|
|
BLAKE2b-256 checksum How to use checksums |
7c51e3a278d7f9a505abeccf7b12995b1d24c3f22657fee30ac39ca5b64af293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / django_gravatar2-1.4.5-py2.py3-none-any.whl
| Download URL | django_gravatar2-1.4.5-py2.py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7e6c8f63f59b0077d42402531684807ea6295867ebd2195a638d87b851f0d41c
|
|
BLAKE2b-256 checksum How to use checksums |
95e322cd408d91f1732582dc266654e8cbc10a5e8c9e8036f299e70bea6827ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for django-gravatar2 1.4.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.