Package: django-simple-avatar
Using django-simple-avatar===================Basics------To integrate ``django-simple-avatar`` with your site, there are relatively few thingsthat are required. A minimal integration can work like this:1. List this application in the ``INSTALLED_APPS`` portion of your settingsfile. Your settings file will look something like::INSTALLED_APPS = (# ...'avatar',)2. Add the pagination urls to the end of your root urlconf. Your urlconfwill look something like::urlpatterns = patterns('',# ...(r'^admin/(.*)', admin.site.root),(r'^avatar/', include('simpleavatar.urls')),)3. Somewhere in your template navigation scheme, link to the change avatarpage::<a href="{% url avatar_change %}">Change your avatar</a>4. Wherever you want to display an avatar for a user, first load the avatartemplate tags::{% load avatar_tags %}Then, use the ``avatar`` tag to display an avatar of a default size::{% avatar user %}Or specify a size (in pixels) explicitly::{% avatar user 65 %}5. Optionally customize ``avatar/change.html`` and``avatar/confirm_delete.html`` to conform to your site's look and feel.Views-----There are only two views for this application: one for changing a user's avatar,and another for deleting a user's avatar.Changing an avatar~~~~~~~~~~~~~~~~~~The actual view function is located at ``avatar.views.change``, and this canbe referenced by the url name ``avatar_change``. It takes two keywordarguments: ``extra_context`` and ``next_override``. If ``extra_context`` isprovided, that context will be placed into the template's context.If ``next_override`` is provided, the user will be redirected to the specifiedURL after form submission. Otherwise the user will be redirected to the URLspecified in the ``next`` parameter in ``request.POST``. If ``request.POST``has no ``next`` parameter, ``request.GET`` will be searched. If ``request.GET``has no ``next`` parameter, the ``HTTP_REFERER`` header will be inspected. Ifthat header does not exist, the user will be redirected back to the current URL.Deleting an avatar~~~~~~~~~~~~~~~~~~The actual view function is located at ``avatar.views.delete``, and this can bereferenced by the url name ``avatar_delete``. It takes the same two keywordarguments as ``avatar.views.change`` and follows the same redirection rulesas well.Template Tags-------------To begin using these template tags, you must first load the tags into thetemplate rendering system:{% load avatar_tags %}``{% avatar_url user [size in pixels] %}``Renders the URL of the avatar for the given user. User can be either a``django.contrib.auth.models.User`` object instance or a username.``{% avatar user [size in pixels] %}``Renders an HTML ``img`` tag for the given user for the specified size. Usercan be either a ``django.contrib.auth.models.User`` object instance or ausername.``{% render_avatar avatar [size in pixels] %}``Given an actual ``avatar.models.Avatar`` object instance, renders an HTML``img`` tag to represent that avatar at the requested size.Global Settings---------------There are a number of settings available to easily customize the avatars thatappear on the site. Listed below are those settings:AUTO_GENERATE_AVATAR_SIZESAn iterable of integers representing the sizes of avatars to generate onupload. This can save rendering time later on if you pre-generate theresized versions. Defaults to ``(80,)``AVATAR_RESIZE_METHODThe method to use when resizing images, based on the options available inPIL. Defaults to ``Image.ANTIALIAS``.AVATAR_STORAGE_DIRThe directory under ``MEDIA_ROOT`` to store the images. If using anon-filesystem storage device, this will simply be appended to the beginningof the file name.AVATAR_GRAVATAR_BACKUPA boolean determining whether to default to the Gravatar service if no``Avatar`` instance is found in the system for the given user. Defaults toTrue.AVATAR_DEFAULT_URLThe default URL to default to if ``AVATAR_GRAVATAR_BACKUP`` is set to Falseand there is no ``Avatar`` instance found in the system for the given user.