Skip to content

Commit

Permalink
Eliminate dependency on default User model from style guide
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gasman authored and lb- committed Sep 28, 2019
1 parent 000c499 commit 44a1e6f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions docs/releases/2.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,9 @@ <h2>Progress indicators</h2>
<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>
Expand Down
4 changes: 0 additions & 4 deletions wagtail/contrib/styleguide/views.py
Original file line number Diff line number Diff line change
@@ -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 _
Expand Down Expand Up @@ -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,
})

0 comments on commit 44a1e6f

Please sign in to comment.