Package: geonode-avatar
BasicsTo integrategeonode-avatarwith your site, there are relatively few things
that are required.  A minimal integration can work like this:List this application in theINSTALLED_APPSportion of your settings
file.  Your settings file will look something like:INSTALLED_APPS = (
    # ...
    'avatar',
)Add the pagination urls to the end of your root urlconf.  Your urlconf
will look something like:urlpatterns = patterns('',
    # ...
    (r'^admin/(.*)', admin.site.root),
    (r'^avatar/', include('avatar.urls')),
)Somewhere in your template navigation scheme, link to the change avatar
page:<a href="{% url avatar_change %}">Change your avatar</a>Wherever you want to display an avatar for a user, first load the avatar
template tags:{% load avatar_tags %}Then, use theavatartag to display an avatar of a default size:{% avatar user %}Or specify a size (in pixels) explicitly:{% avatar user 65 %}Optionally customizeavatar/change.htmlandavatar/confirm_delete.htmlto conform to your site’s look and feel.ViewsThere are only two views for this application: one for changing a user’s
avatar, and another for deleting a user’s avatar.Changing an avatarThe actual view function is located atavatar.views.change, and this can
be referenced by the url nameavatar_change.  It takes two keyword
arguments:extra_contextandnext_override.  Ifextra_contextis
provided, that context will be placed into the template’s context.Ifnext_overrideis provided, the user will be redirected to the specified
URL after form submission.  Otherwise the user will be redirected to the URL
specified in thenextparameter inrequest.POST.  Ifrequest.POSThas nonextparameter,request.GETwill be searched.  Ifrequest.GEThas nonextparameter, theHTTP_REFERERheader will
be inspected.  If that header does not exist, the user will be redirected
back to the current URL.Deleting an avatarThe actual view function is located atavatar.views.delete, and this can be
referenced by the url nameavatar_delete.  It takes the same two keyword
arguments asavatar.views.changeand follows the same redirection rules
as well.Template TagsTo begin using these template tags, you must first load the tags into the
template 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 adjango.contrib.auth.models.Userobject instance or a username.{% avatar user [size in pixels] %}Renders an HTMLimgtag for the given user for the specified size.
User can be either adjango.contrib.auth.models.Userobject instance
or a username.{% render_avatar avatar [size in pixels] %}Given an actualavatar.models.Avatarobject instance, renders an HTMLimgtag to represent that avatar at the requested size.Global SettingsThere are a number of settings available to easily customize the avatars that
appear on the site.  Listed below are those settings:AUTO_GENERATE_AVATAR_SIZESAn iterable of integers representing the sizes of avatars to generate on
upload.  This can save rendering time later on if you pre-generate the
resized versions.  Defaults to(80,)AVATAR_RESIZE_METHODThe method to use when resizing images, based on the options available in
PIL.  Defaults toImage.ANTIALIAS.AVATAR_STORAGE_DIRThe directory underMEDIA_ROOTto store the images.  If using a
non-filesystem storage device, this will simply be appended to the
beginning of the file name.AVATAR_GRAVATAR_BACKUPA boolean determining whether to default to the Gravatar service if noAvatarinstance is found in the system for the given user.  Defaults to
True.AVATAR_DEFAULT_URLThe default URL to default to ifAVATAR_GRAVATAR_BACKUPis set to False
and there is noAvatarinstance found in the system for the given user.Management CommandsThis application does include one management command:rebuild_avatars.  It
takes no arguments and, when run, re-renders all of the thumbnails for all of
the avatars for the pixel sizes specified in theAUTO_GENERATE_AVATAR_SIZESsetting.