A simple Django app to get avatars based on username and initials if no gravatars is associated to the email address.
Project description
django-initial-avatars
django-initial-avatars is a simple Django app which generates avatars based on username and initials. If django_gravatar is installed, user gravatar is preferred.
Dependencies
Generating avatars requires a Pillow installation with freetype support.
freetype can easily be installed on ubuntu with:
$ sudo aptitude install libfreetype6-dev
or on OS X with homebrew:
$ brew install freetype
After installing freetype Pillow may need to be rebuilt.
Font licensing
For generating the avatar the font Ubuntu Monospace is used. The font is licensed under the Ubuntu Font Licence, see the License <http://font.ubuntu.com/licence/>
Quick start
install app requirements
install django-initial-avatars through pip:
pip install django-initial-avatars
If you want to use gravatar for users who have one, install django-gravatar2:
pip install django-gravatar2
Add “django-initial-avatars” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'initial_avatars', ['django_gravatar',] )
Include the django-initial-avatar URLconf in your project urls.py like this:
url(r'^avatar/', include('initial_avatars.urls')),
Launch development server:
python manage.py runserver
Each user has now an endpoint for his avatar:
localhost:8000/avatar/user_id/[size/]
In your templates, use:
{% load initialavatar %} {% get_initial_avatar user [size] %} {% get_initial_avatar user.email [size] %}
Tests
Django-initial-avatars is provided with tests, they require django-gravatar2
You can launch them in the virtualenv like this:
python runtests.py
It might happen that a calculated position fails because of a minor difference in the result, don’t care about it.
Contributing
Contributions are welcome ! Feel free to write an issue for any feedback you have or send a pull request on Github <https://github.com/axiome-oss/django-initial-avatars>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-initial-avatars-0.5.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24e21a0db26e82213947962165d92fa36fb3d2287f521f6615ce49852d6a9a4d |
|
MD5 | 754090ff0578374984ebb9629718d700 |
|
BLAKE2b-256 | 93ef7526a5e7a53564a2a13a85e34b3f06197695f6c22f3848c31b43f2ae6b0f |