From 44a1e6f9f8906d27b82c409549744a16c604ee43 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Wed, 24 Jul 2019 17:26:33 +0100 Subject: [PATCH] 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. --- CHANGELOG.txt | 1 + docs/releases/2.7.rst | 1 + .../styleguide/templates/wagtailstyleguide/base.html | 6 +++--- wagtail/contrib/styleguide/views.py | 4 ---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f16368ebf..b43cc186d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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) diff --git a/docs/releases/2.7.rst b/docs/releases/2.7.rst index 019cdba5d..7af5696ba 100644 --- a/docs/releases/2.7.rst +++ b/docs/releases/2.7.rst @@ -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 diff --git a/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html b/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html index 97f0d628c..89261cfc0 100644 --- a/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html +++ b/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html @@ -742,9 +742,9 @@

Misc formatters

Avatar icons

-

Avatar normal

-

Avatar square

-

Avatar small

+

Avatar normal

+

Avatar square

+

Avatar small

Status tags

Primary tag
diff --git a/wagtail/contrib/styleguide/views.py b/wagtail/contrib/styleguide/views.py index fffb23ca0..e1a7c1b89 100644 --- a/wagtail/contrib/styleguide/views.py +++ b/wagtail/contrib/styleguide/views.py @@ -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, })