mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
Rename util -> utils, fix URL issue
This commit is contained in:
parent
a6b4c2beea
commit
5cbd095cda
9 changed files with 23 additions and 25 deletions
|
|
@ -6,8 +6,10 @@ Changelog
|
|||
* Added the ability to use a Facebook Graph avatar as a backup.
|
||||
* Added a way to customize where avatars are stored.
|
||||
* Added a setting to disable the avatar cache.
|
||||
* Updated thumbnail creation to preserve RGBA.
|
||||
* Fixed issue where ``render_primary`` would not work if username/email was greater than 30 characters.
|
||||
* Fixed issue where cache was not invalidated after updating avatar
|
||||
* Renamed the ``avatar.util`` module to ``avatar.utils``.
|
||||
* **Backwards Incompatible:** Renamed the ``avatar.util`` module to ``avatar.utils``.
|
||||
|
||||
* 2.2.1 (January 11, 2016)
|
||||
* Added AVATAR_GRAVATAR_FIELD setting to define the user field to get the gravatar email.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from django.template.loader import render_to_string
|
|||
|
||||
from avatar.models import Avatar
|
||||
from avatar.signals import avatar_updated
|
||||
from avatar.util import get_user_model
|
||||
from avatar.utils import get_user_model
|
||||
|
||||
|
||||
class AvatarAdmin(admin.ModelAdmin):
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from django.utils import six
|
|||
from django.db.models import signals
|
||||
|
||||
from avatar.conf import settings
|
||||
from avatar.util import get_username, force_bytes, invalidate_cache
|
||||
from avatar.utils import get_username, force_bytes, invalidate_cache
|
||||
|
||||
try:
|
||||
from django.utils.timezone import now
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ from django.utils.translation import ugettext as _
|
|||
from django.utils.module_loading import import_string
|
||||
|
||||
from avatar.conf import settings
|
||||
from avatar.util import (get_primary_avatar, get_default_avatar_url,
|
||||
cache_result, get_user_model, get_user, force_bytes)
|
||||
from avatar.utils import (get_primary_avatar, get_default_avatar_url,
|
||||
cache_result, get_user_model, get_user, force_bytes)
|
||||
from avatar.models import Avatar
|
||||
|
||||
register = template.Library()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ urlpatterns = [
|
|||
url(r'^add/$', views.add, name='avatar_add'),
|
||||
url(r'^change/$', views.change, name='avatar_change'),
|
||||
url(r'^delete/$', views.delete, name='avatar_delete'),
|
||||
url(r'^render_primary/(?P<user>[\w\d\@\.\-_]{3,30})/(?P<size>[\d]+)/$',
|
||||
url(r'^render_primary/(?P<user>[\w\d\@\.\-_]+)/(?P<size>[\d]+)/$',
|
||||
views.render_primary,
|
||||
name='avatar_render_primary'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ def cache_result(default_size=settings.AVATAR_DEFAULT_SIZE):
|
|||
Decorator to cache the result of functions that take a ``user`` and a
|
||||
``size`` value.
|
||||
"""
|
||||
|
||||
if not settings.AVATAR_CACHE_ENABLED:
|
||||
def decorator(func):
|
||||
return func
|
||||
|
|
@ -9,8 +9,8 @@ from avatar.conf import settings
|
|||
from avatar.forms import PrimaryAvatarForm, DeleteAvatarForm, UploadAvatarForm
|
||||
from avatar.models import Avatar
|
||||
from avatar.signals import avatar_updated
|
||||
from avatar.util import (get_primary_avatar, get_default_avatar_url,
|
||||
invalidate_cache)
|
||||
from avatar.utils import (get_primary_avatar, get_default_avatar_url,
|
||||
invalidate_cache)
|
||||
|
||||
|
||||
def _get_next(request):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.test.utils import override_settings
|
|||
|
||||
from avatar.admin import AvatarAdmin
|
||||
from avatar.conf import settings
|
||||
from avatar.util import get_primary_avatar, get_user_model
|
||||
from avatar.utils import get_primary_avatar, get_user_model
|
||||
from avatar.models import Avatar
|
||||
from PIL import Image
|
||||
|
||||
|
|
@ -158,14 +158,6 @@ class AvatarTests(TestCase):
|
|||
self.assertNotEqual(response.context['upload_avatar_form'].errors, {})
|
||||
self.assertEqual(count_before, count_after)
|
||||
|
||||
# def testAvatarOrder
|
||||
# def testReplaceAvatarWhenMaxIsOne
|
||||
# def testHashFileName
|
||||
# def testHashUserName
|
||||
# def testChangePrimaryAvatar
|
||||
# def testDeleteThumbnailAndRecreation
|
||||
# def testAutomaticThumbnailCreation
|
||||
|
||||
@override_settings(AVATAR_THUMB_FORMAT='png')
|
||||
def testAutomaticThumbnailCreationRGBA(self):
|
||||
upload_helper(self, "django.png")
|
||||
|
|
@ -178,3 +170,11 @@ class AvatarTests(TestCase):
|
|||
avatar = get_primary_avatar(self.user)
|
||||
image = Image.open(avatar.avatar.storage.open(avatar.avatar_name(settings.AVATAR_DEFAULT_SIZE), 'rb'))
|
||||
self.assertEqual(image.mode, 'RGB')
|
||||
|
||||
# def testAvatarOrder
|
||||
# def testReplaceAvatarWhenMaxIsOne
|
||||
# def testHashFileName
|
||||
# def testHashUserName
|
||||
# def testChangePrimaryAvatar
|
||||
# def testDeleteThumbnailAndRecreation
|
||||
# def testAutomaticThumbnailCreation
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
try:
|
||||
from django.conf.urls import patterns, include
|
||||
except ImportError:
|
||||
from django.conf.urls.defaults import patterns, include
|
||||
from django.conf.urls import include, url
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^avatar/', include('avatar.urls')),
|
||||
)
|
||||
urlpatterns = [
|
||||
url(r'^avatar/', include('avatar.urls')),
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue