tbabej/django-avatar — pull request #18 by palmplam (2014-08-18 17:47:25+00:00)
Title: Add an extra param to use user_id as userdirname instead of username

New pull request refer to #15

-----------------------------

Why a new parameter ?
In some django project, user can change username (like in github for example :P)
In this case, django-avatar did not manage storage as well and multiply folders with new files, regenerate thumbnails when needed and can't manage them in case of delete for example.

To fix this trouble and potential storage issue, i propose a simple new parameter ``USERID_AS_USERDIRNAME``, a boolean, ``False`` by default.

I add a new management command ``migrate_avatars`` to move avatar files, update avatar.url in database, re-generate defaults thumbnails, and delete old folders in case of des/activate ``USERID_AS_USERDIRNAME`` (work for any config change who impact avatar storage path pattern like ``HASH_USERDIRNAMES`` for example).