# HG changeset patch # User Brian Neal # Date 1328234959 21600 # Node ID 4e891919c63f11af0f293f48c6768687664b8cce # Parent b9a41956be23e6ed85f4f2f388b8cc60b3d002e5 Changed the avatar upload_to path to not rely on the user supplied name, as this has caused problems in the past (too long). Now just store avatars under media/avatars/users/username.ext. diff -r b9a41956be23 -r 4e891919c63f gpp/bio/models.py --- a/gpp/bio/models.py Thu Feb 02 19:05:46 2012 -0600 +++ b/gpp/bio/models.py Thu Feb 02 20:09:19 2012 -0600 @@ -61,11 +61,12 @@ html.allow_tags = True -def avatar_file_path_for_user(username, filename): - return os.path.join(settings.AVATAR_DIR, 'users', username, filename) - def avatar_file_path(instance, filename): - return avatar_file_path_for_user(instance.user.username, filename) + ext = os.path.splitext(filename)[1] + if not ext: + ext = '.jpg' + avatar_name = instance.user.username + ext + return os.path.join(settings.AVATAR_DIR, 'users', avatar_name) class UserProfile(models.Model):