Skip to content

Commit

Permalink
Upgrade to wagtail 2.9. Required adjusting for deprecation of wagtail…
Browse files Browse the repository at this point in the history
….core.middleware.SiteMiddleware.
  • Loading branch information
rjsparks committed Jun 8, 2020
1 parent 598e8b0 commit 83c0799
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
3 changes: 2 additions & 1 deletion ietf/blog/feeds.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib.syndication.views import Feed
from django.db.models.functions import Coalesce
from wagtail.core.models import Site
from ..blog.models import BlogPage
from ..utils.models import FeedSettings

Expand All @@ -8,7 +9,7 @@ class BlogFeed(Feed):
link = "/blog/"

def __call__(self, request, *args, **kwargs):
settings = FeedSettings.for_site(request.site)
settings = FeedSettings.for_site(Site.find_for_request(request))
self.title = settings.blog_feed_title
self.description = settings.blog_feed_description
return super().__call__(request, *args, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions ietf/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from modelcluster.fields import ParentalKey

from wagtail.core.models import Page
from wagtail.core.models import Page, Site
from wagtail.core.fields import StreamField
from wagtail.snippets.edit_handlers import (
SnippetChooserPanel
Expand Down Expand Up @@ -232,7 +232,7 @@ def get_context(self, request, *args, **kwargs):
max_siblings_to_show = 5
query_string = "?"
filter_text_builder = build_filter_text
feed_settings = FeedSettings.for_site(request.site)
feed_settings = FeedSettings.for_site(Site.find_for_request(request))

# This is mostly duplicted in BlogIndexPage
for parameter, functions in parameter_functions_map.items():
Expand Down
1 change: 0 additions & 1 deletion ietf/iesg_statement/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def get_context(self, request, *args, **kwargs):
siblings = self.siblings
query_string = "?"
filter_text_builder = build_filter_text
# TODO feed_settings = FeedSettings.for_site(request.site)

for parameter, functions in parameter_functions_map.items():
search_query = request.GET.get(parameter)
Expand Down
5 changes: 0 additions & 5 deletions ietf/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
BASE_DIR = os.path.dirname(PROJECT_DIR)


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/


# Application definition

INSTALLED_APPS = (
Expand Down Expand Up @@ -88,7 +84,6 @@
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',

'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]

Expand Down
8 changes: 4 additions & 4 deletions ietf/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ settings.utils.SocialMediaSettings.twitter_handle }}" />
<meta name="twitter:title" content="{{ page.title }}" />
<meta name="twitter:description" content="{% social_text page request.site %}">
<meta name="twitter:image" content="{% social_image page request.site %}">
<meta name="twitter:description" content="{% social_text page wagtail_site %}">
<meta name="twitter:image" content="{% social_image page wagtail_site %}">

<!--facebook opengraph tags-->
<meta property="fb:app_id" content="{{ settings.utils.SocialMediaSettings.facebook_app_id }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ page.url }}" />
<meta property="og:title" content="{{ page.title }}" />
<meta property="og:image" content="{% social_image page request.site %}" />
<meta property="og:description" content="{% social_text page request.site %}" />
<meta property="og:image" content="{% social_image page wagtail_site %}" />
<meta property="og:description" content="{% social_text page wagtail_site %}" />
<meta property="og:site_name" content="{{ settings.utils.SocialMediaSettings.site_name }}" />

{% block extra_meta %}{% endblock extra_meta %}
Expand Down
6 changes: 3 additions & 3 deletions ietf/templates/includes/social-sharebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<div class="social-sharebar">
<div class="social-sharebar__button">Share this page</div>
<div class="social-sharebar__icons">
<a title="Share on Facebook" href="https://www.facebook.com/dialog/feed?app_id={{ social_media_settings.facebook_app_id }}&amp;link={{ page.full_url|urlencode }}&amp;picture={% social_image page request.site %}&amp;name={{ page.title|urlencode }}&amp;description={% social_text page request.site 'True '%}&amp;redirect_uri={{ page.full_url|urlencode }}">
<a title="Share on Facebook" href="https://www.facebook.com/dialog/feed?app_id={{ social_media_settings.facebook_app_id }}&amp;link={{ page.full_url|urlencode }}&amp;picture={% social_image page wagtail_site %}&amp;name={{ page.title|urlencode }}&amp;description={% social_text page wagtail_site 'True '%}&amp;redirect_uri={{ page.full_url|urlencode }}">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 64"><path d="M30 0v10.3s-7.6-.8-9.5 2.2c-1 1.6-.4 6.2-.5 9.6h10.1c-.9 3.9-1.5 6.6-2.1 9.9h-8v32H6V32.1H.1V22H6c.2-7.3.3-14.6 3.9-18.3C14.1-.5 18 0 30 0z"/></svg>
</a>
<a title="Share on Twitter" href="https://twitter.com/intent/tweet?text={% social_text page request.site 'True' %}&amp;url={{ page.full_url|urlencode }}&amp;via={{ social_media_settings.twitter_handle|urlencode }}">
<a title="Share on Twitter" href="https://twitter.com/intent/tweet?text={% social_text page wagtail_site 'True' %}&amp;url={{ page.full_url|urlencode }}&amp;via={{ social_media_settings.twitter_handle|urlencode }}">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 51.9"><path d="M43.5 0c5.1-.1 7.8 1.8 10.4 4.1 2.2-.2 5-1.4 6.7-2.3.5-.3 1.1-.6 1.6-.9-1 2.6-2.3 4.6-4.3 6.2-.4.3-.9.8-1.4 1 2.8 0 5.2-1.3 7.4-2-1.2 1.9-2.8 3.8-4.5 5.1-.7.5-1.4 1.1-2 1.6 0 3 0 5.9-.6 8.4-3.3 14.7-12 24.7-25.7 29-4.9 1.5-12.9 2.2-18.6.8-2.8-.7-5.3-1.5-7.7-2.5-1.3-.6-2.5-1.2-3.7-1.9-.3-.1-.7-.3-1.1-.6 1.3 0 2.8.4 4.2.2 1.3-.2 2.6-.2 3.7-.4 3-.7 5.6-1.5 7.9-2.8 1.1-.6 2.8-1.4 3.6-2.3-1.5 0-2.8-.3-3.9-.7-4.2-1.5-6.7-4.3-8.3-8.4 1.3.1 5 .5 5.9-.3-1.6-.1-3.2-1-4.3-1.7-3.4-2.1-6.2-5.7-6.2-11.2.4.2.9.4 1.3.6.9.4 1.7.6 2.8.8.4.1 1.3.3 1.8.2h-.1c-.7-.8-1.7-1.3-2.4-2.1C3.8 15 1.7 10.8 3 5.8c.3-1.3.9-2.4 1.4-3.4h.1c.2.6.8 1 1.2 1.4 1.1 1.4 2.5 2.6 3.9 3.7 4.8 3.7 9.1 6.1 16 7.8 1.8.4 3.8.8 5.9.8-.6-1.7-.4-4.5.1-6.2 1.2-4.2 3.7-7.2 7.4-8.8.9-.4 1.9-.7 2.9-.9.6-.1 1.1-.1 1.6-.2z"/></svg>
</a>
<a title="Share on LinkedIn" href="https://www.linkedin.com/shareArticle?mini=true&amp;url={{ page.full_url|urlencode }}&amp;title={{ page.title|urlencode }}&amp;summary={% social_text page request.site 'True' %}&amp;source={{ social_media_settings.site_name|urlencode }}">
<a title="Share on LinkedIn" href="https://www.linkedin.com/shareArticle?mini=true&amp;url={{ page.full_url|urlencode }}&amp;title={{ page.title|urlencode }}&amp;summary={% social_text page wagtail_site 'True' %}&amp;source={{ social_media_settings.site_name|urlencode }}">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" viewBox="0 0 32 32" xml:space="preserve"> <defs> </defs> <path d="M26 25.963h-4.185v-6.55c0-1.56-.027-3.57-2.175-3.57-2.18 0-2.51 1.7-2.51 3.46v6.66h-4.182V12.495h4.012v1.84h.058c.558-1.058 1.924-2.174 3.96-2.174 4.24 0 5.022 2.79 5.022 6.418v7.386zM8.23 10.655a2.426 2.426 0 0 1 0-4.855 2.427 2.427 0 0 1 0 4.855zm-2.098 1.84h4.19v13.468h-4.19V12.495z" fill-rule="evenodd"></path></svg>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Django>=2.2,<3
djangorestframework>=3.8
psycopg2>=2.7.5
wagtail>=2.8,<2.9
wagtail>=2.9,<2.10
django-libsass>=0.8
libsass>=0.8.3
future>=0.15.2
Expand Down

0 comments on commit 83c0799

Please sign in to comment.