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

New pull request refer to https://github.com/tbabej/django-avatar/pull/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_USERDIRNAMES", a boolean, False by default.

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