Eliminate dependency on default User model from style guide

Fixes #5442. Building a User object for david@torchbox.com may cause problems if a custom user model is in use, and is redundant anyhow because there's no longer a registered gravatar for that email - we should just hard-code the default blank avatar instead.
This commit is contained in:
Matt Westcott 2019-07-24 17:26:33 +01:00 committed by LB
parent 000c4990b4
commit 44a1e6f9f8
4 changed files with 5 additions and 7 deletions

View file

@ -39,6 +39,7 @@ Changelog
* Fix: Language chosen in user preferences no longer persists on subsequent requests (Bojan Mihelac)
* Fix: Prevent new block IDs from being assigned on repeated calls to `StreamBlock.get_prep_value` (Colin Klein)
* Fix: Prevent broken images in notification emails when static files are hosted on a remote domain (Eduard Luca)
* Fix: Replace styleguide example avatar with default image to avoid issues when custom user model is used (Matt Westcott)
2.6.2 (19.09.2019)

View file

@ -63,6 +63,7 @@ Bug fixes
* Language chosen in user preferences no longer persists on subsequent requests (Bojan Mihelac)
* Prevent new block IDs from being assigned on repeated calls to ``StreamBlock.get_prep_value`` (Colin Klein)
* Prevent broken images in notification emails when static files are hosted on a remote domain (Eduard Luca)
* Replace styleguide example avatar with default image to avoid issues when custom user model is used (Matt Westcott)
Upgrade considerations

View file

@ -742,9 +742,9 @@
<h2>Misc formatters</h2>
<h3>Avatar icons</h3>
<p><span class="avatar"><img src="{% avatar_url user size=50 %}" alt="" /></span> Avatar normal</p>
<p><span class="avatar square"><img src="{% avatar_url user size=50 %}" alt="" /></span> Avatar square</p>
<p><span class="avatar small"><img src="{% avatar_url user size=25 %}" alt="" /></span> Avatar small</p>
<p><span class="avatar"><img src="{% static 'wagtailadmin/images/default-user-avatar.png' %}" alt="" /></span> Avatar normal</p>
<p><span class="avatar square"><img src="{% static 'wagtailadmin/images/default-user-avatar.png' %}" alt="" /></span> Avatar square</p>
<p><span class="avatar small"><img src="{% static 'wagtailadmin/images/default-user-avatar.png' %}" alt="" /></span> Avatar small</p>
<h3>Status tags</h3>
<div class="status-tag primary">Primary tag</div>

View file

@ -1,5 +1,4 @@
from django import forms
from django.contrib.auth.models import User
from django.core.paginator import Paginator
from django.shortcuts import render
from django.utils.translation import ugettext as _
@ -72,11 +71,8 @@ def index(request):
paginator = Paginator(list(range(100)), 10)
page = paginator.page(2)
user = User(email='david@torchbox.com')
return render(request, 'wagtailstyleguide/base.html', {
'search_form': form,
'example_form': example_form,
'example_page': page,
'user': user,
})