django-gravatar
================
.. image:: https://travis-ci.org/twaddington/django-gravatar.svg?branch=master
:target: https://travis-ci.org/twaddington/django-gravatar
A lightweight django-gravatar app. Includes helper methods for interacting with gravatars outside of template code.
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 <http://pypi.python.org/pypi/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 <https://github.com/twaddington/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
Raw data
{
"_id": null,
"home_page": "https://github.com/twaddington/django-gravatar",
"name": "django-gravatar2",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "django gravatar avatar",
"author": "Tristan Waddington",
"author_email": "tristan.waddington@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c3/8d/b67a00ff478ba09aa015fbb1cb2bd8537e602ffb0219532191d7e2461a41/django-gravatar2-1.4.4.tar.gz",
"platform": "",
"description": "django-gravatar\n================\n\n.. image:: https://travis-ci.org/twaddington/django-gravatar.svg?branch=master\n :target: https://travis-ci.org/twaddington/django-gravatar\n\nA lightweight django-gravatar app. Includes helper methods for interacting with gravatars outside of template code.\n\nFeatures\n--------\n\n- Helper methods for constructing a gravatar url and checking an email for an existing gravatar\n- Templatetags for generating a gravatar url or gravatar <img> tag.\n- Full test suite!\n\nInstalling\n----------\nInstall from PyPi:\n\nYou can pip install the app directly from GitHub:\n\n::\n\n $ pip install git+git://github.com/twaddington/django-gravatar.git#egg=DjangoGravatar\n\nAlternatively, you can now install directly from PyPi!\n\n::\n\n $ pip install django-gravatar2\n\nMake sure you install `django-gravatar2 <http://pypi.python.org/pypi/django-gravatar2>`_ as\nthere are several other incompatible django-gravatar libraries available.\n\nAdd django_gravatar to your INSTALLED_APPS in settings.py:\n\n::\n\n INSTALLED_APPS = (\n # ...\n 'django_gravatar',\n )\n\nBasic Usage\n-----------\nUse in code:\n\n::\n\n from django_gravatar.helpers import get_gravatar_url, has_gravatar, get_gravatar_profile_url, calculate_gravatar_hash\n\n url = get_gravatar_url('alice@example.com', size=150)\n gravatar_exists = has_gravatar('bob@example.com')\n profile_url = get_gravatar_profile_url('alice@example.com')\n email_hash = calculate_gravatar_hash('alice@example.com')\n\nUse in templates:\n\n::\n\n {% load gravatar %}\n\n {% gravatar_url user.email 150 %}\n # https://secure.gravatar.com/avatar/hash.jpg?size=150\n\n {% gravatar user.email 150 %}\n # <img class=\"gravatar\" src=\"https://secure.gravatar.com/avatar/hash.jpg?size=150\" width=\"150\" height=\"150\" alt=\"\" />\n\n {% gravatar user.email 150 \"user@example.com\" %}\n # <img class=\"gravatar\" src=\"https://secure.gravatar.com/avatar/hash.jpg?size=150\" width=\"150\" height=\"150\" alt=\"user@example.com\" />\n\n {% gravatar_profile_url user.email %}\n # https://secure.gravatar.com/hash\n\nConfiguring\n-----------\nThe following options can be configured in your settings.py:\n\nGRAVATAR_URL # Gravatar base url. Defaults to 'http://www.gravatar.com/'\n\nGRAVATAR_SECURE_URL # Gravatar base secure https url. Defaults to 'https://secure.gravatar.com/'\n\nGRAVATAR_DEFAULT_SIZE # Gravatar size in pixels. Defaults to '80'\n\nGRAVATAR_DEFAULT_IMAGE # An image url or one of the following: 'mm', 'identicon', 'monsterid', 'wavatar', 'retro'. Defaults to 'mm'\n\nGRAVATAR_DEFAULT_RATING # One of the following: 'g', 'pg', 'r', 'x'. Defaults to 'g'\n\nGRAVATAR_DEFAULT_SECURE # True to use https by default, False for plain http. Defaults to True\n\nContributing\n------------\nFeel free to `fork django-gravatar <https://github.com/twaddington/django-gravatar>`_\non GitHub! We'd love to see your pull requests. Please make sure you run\ntests before submitting a patch.\n\nRun tests:\n\n::\n\n $> cd example_project\n $> ./manage.py test django_gravatar\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Essential Gravatar support for Django. Features helper methods, templatetags and a full test suite!",
"version": "1.4.4",
"project_urls": {
"Homepage": "https://github.com/twaddington/django-gravatar"
},
"split_keywords": [
"django",
"gravatar",
"avatar"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "95122c6697e06fc5e2bc368f04ba7a7af0c8f26cba82d377504385a7be5eb483",
"md5": "2c6420ead9ef63279759f8441867f6b0",
"sha256": "545a6c2c5c624c7635dec29c7bc0be1a2cb89c9b8821af8616ae9838827cc35b"
},
"downloads": -1,
"filename": "django_gravatar2-1.4.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c6420ead9ef63279759f8441867f6b0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 7858,
"upload_time": "2020-02-03T18:34:01",
"upload_time_iso_8601": "2020-02-03T18:34:01.079964Z",
"url": "https://files.pythonhosted.org/packages/95/12/2c6697e06fc5e2bc368f04ba7a7af0c8f26cba82d377504385a7be5eb483/django_gravatar2-1.4.4-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c38db67a00ff478ba09aa015fbb1cb2bd8537e602ffb0219532191d7e2461a41",
"md5": "904d37f01397a0ec1ced8aebe908842b",
"sha256": "c813280967511ced93eea0359f60e5369c35b3311efe565c3e5d4ab35c10c9ee"
},
"downloads": -1,
"filename": "django-gravatar2-1.4.4.tar.gz",
"has_sig": false,
"md5_digest": "904d37f01397a0ec1ced8aebe908842b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8396,
"upload_time": "2020-02-03T18:34:02",
"upload_time_iso_8601": "2020-02-03T18:34:02.584251Z",
"url": "https://files.pythonhosted.org/packages/c3/8d/b67a00ff478ba09aa015fbb1cb2bd8537e602ffb0219532191d7e2461a41/django-gravatar2-1.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-02-03 18:34:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "twaddington",
"github_project": "django-gravatar",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "django-gravatar2"
}