This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
afabiani
committed
Feb 10, 2020
1 parent
f5a81c0
commit 9a0fd60
Showing
72 changed files
with
3,713 additions
and
855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,4 @@ | ||
This application is mainly developed by Eric Florenzano. | ||
This application was originally written by Eric Florenzano. | ||
It is now maintained by Grant McConnaughey and a league of awesome contributors. | ||
|
||
Ahmad Al-Ibrahim | ||
Alex Gaynor | ||
Ben Browitt | ||
Brian Rosner | ||
Daniel T. Alvarenga | ||
Jakob Torp Svendsen | ||
James Tauber | ||
James Turnbull | ||
Jannis Leidel | ||
John Debs | ||
Mathieu Pillard | ||
Ross Poulton | ||
See the full list here: https://github.com/grantmcconnaughey/django-avatar/graphs/contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '5.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
from django.contrib import admin | ||
# Issue 182: six no longer included with Django 3.0 | ||
try: | ||
from django.utils import six | ||
except ImportError: | ||
import six | ||
from django.utils.translation import ugettext_lazy as _ | ||
from django.template.loader import render_to_string | ||
|
||
from avatar.models import Avatar | ||
from avatar.signals import avatar_updated | ||
from avatar.utils import get_user_model | ||
|
||
|
||
class AvatarAdmin(admin.ModelAdmin): | ||
list_display = ('get_avatar', 'user', 'primary', "date_uploaded") | ||
list_filter = ('primary',) | ||
search_fields = ('user__%s' % getattr(get_user_model(), 'USERNAME_FIELD', 'username'),) | ||
list_per_page = 50 | ||
|
||
def get_avatar(self, avatar_in): | ||
context = dict({ | ||
'user': avatar_in.user, | ||
'url': avatar_in.avatar.url, | ||
'alt': six.text_type(avatar_in.user), | ||
'size': 80, | ||
}) | ||
return render_to_string('avatar/avatar_tag.html', context) | ||
|
||
get_avatar.short_description = _('Avatar') | ||
get_avatar.allow_tags = True | ||
|
||
def save_model(self, request, obj, form, change): | ||
super(AvatarAdmin, self).save_model(request, obj, form, change) | ||
avatar_updated.send(sender=Avatar, user=request.user, avatar=obj) | ||
|
||
|
||
admin.site.register(Avatar) | ||
admin.site.register(Avatar, AvatarAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from django.conf import settings | ||
from PIL import Image | ||
|
||
from appconf import AppConf | ||
|
||
|
||
class AvatarConf(AppConf): | ||
DEFAULT_SIZE = 80 | ||
RESIZE_METHOD = Image.ANTIALIAS | ||
STORAGE_DIR = 'avatars' | ||
PATH_HANDLER = 'avatar.models.avatar_path_handler' | ||
GRAVATAR_BASE_URL = 'https://www.gravatar.com/avatar/' | ||
GRAVATAR_FIELD = 'email' | ||
GRAVATAR_DEFAULT = None | ||
AVATAR_GRAVATAR_FORCEDEFAULT = False | ||
DEFAULT_URL = 'avatar/img/default.jpg' | ||
MAX_AVATARS_PER_USER = 42 | ||
MAX_SIZE = 1024 * 1024 | ||
THUMB_FORMAT = 'JPEG' | ||
THUMB_QUALITY = 85 | ||
HASH_FILENAMES = False | ||
HASH_USERDIRNAMES = False | ||
EXPOSE_USERNAMES = True | ||
ALLOWED_FILE_EXTS = None | ||
CACHE_TIMEOUT = 60 * 60 | ||
STORAGE = settings.DEFAULT_FILE_STORAGE | ||
CLEANUP_DELETED = False | ||
AUTO_GENERATE_SIZES = (DEFAULT_SIZE,) | ||
FACEBOOK_GET_ID = None | ||
CACHE_ENABLED = True | ||
RANDOMIZE_HASHES = False | ||
ADD_TEMPLATE = '' | ||
CHANGE_TEMPLATE = '' | ||
DELETE_TEMPLATE = '' | ||
PROVIDERS = ( | ||
'avatar.providers.PrimaryAvatarProvider', | ||
'avatar.providers.GravatarAvatarProvider', | ||
'avatar.providers.DefaultAvatarProvider', | ||
) | ||
|
||
def configure_auto_generate_avatar_sizes(self, value): | ||
return value or getattr(settings, 'AVATAR_AUTO_GENERATE_SIZES', | ||
(self.DEFAULT_SIZE,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.