diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 713d057..18f47d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/AUTHORS b/AUTHORS index f35c7cf..556aab7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,3 +13,5 @@ * Yed Podtrzitko * Francisco Fernández * Pep Lluís Miró +* Wesley van Lee +* Marco Badan \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e4b0ec..f371653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +Unreleased +---------- +* Add Wagtail 6.1 support. Drop Wagtail <=5.2 support. +* Add Django 5.0 support. + 2.0.0 (2023-07-04) ------------------ * Add Wagtail 5.0 support. Drop Wagtail <=4.0 support. @@ -93,7 +98,7 @@ Changelog * Fix header image. 1.0 (2018-04-10) ----------------- +------------------ * Add support for Django 2.0 and Wagtail 2.0. Drop Python 2.7 support. * Add code and block quote options to the entries text editor. * Improve default template visualisation. @@ -106,7 +111,7 @@ Changelog * Add German and Polish translations. 0.9.1 (2017-09-12) ------------------- +---------------- * Add missing migration. 0.9 (2017-08-03) @@ -125,7 +130,7 @@ Changelog * Minor template tweaks. 0.7 (2016-08-18) ----------------- +------------------ * Add initial travis support. * Add canonical url and social share tags in templates for SEO purposes. * Allow to place Puput's blog at any sitemap level. @@ -135,7 +140,7 @@ Changelog * Minor bug fixes. 0.6 (2016-05-18) ----------------- +------------------ * Fix issue when displaying entries without images. * Fix css issues. * Add django-compressor as project dependency. @@ -151,7 +156,7 @@ Changelog * Fix bug due a missing template tag. 0.5 (2016-02-12) ----------------- +------------------ * Altered URL structure in order to have blog as Wagtail root page. * Added Docker integration. * Archive list is now collapsible. diff --git a/docs/setup.rst b/docs/setup.rst index 70457c7..300c752 100644 --- a/docs/setup.rst +++ b/docs/setup.rst @@ -26,7 +26,7 @@ If you are already referencing one of these apps in your :code:`INSTALLED_APPS` INSTALLED_APPS = ( ... 'wagtail.contrib.legacy.richtext', - 'wagtail.core', + 'wagtail', 'wagtail.admin', 'wagtail.documents', 'wagtail.snippets', @@ -41,7 +41,6 @@ If you are already referencing one of these apps in your :code:`INSTALLED_APPS` 'wagtail.contrib.routable_page', 'taggit', 'modelcluster', - 'django_social_share', 'puput', ) @@ -135,7 +134,7 @@ Installation on top of Wagtail pip install --upgrade pip pip install wheel - pip install wagtail django-colorful django-el-pagination django-social-share + pip install wagtail django-el-pagination pip install --no-deps puput wagtail start mysite cd mysite @@ -149,9 +148,7 @@ Installation on top of Wagtail 'wagtail.contrib.sitemaps', 'wagtail.contrib.routable_page', - 'django_social_share', 'puput', - 'colorful', 3. In the same file, also add the line :code:`PUPUT_AS_PLUGIN = True` to the very bottom diff --git a/puput/__init__.py b/puput/__init__.py index 9b2e170..84dff05 100644 --- a/puput/__init__.py +++ b/puput/__init__.py @@ -15,13 +15,13 @@ "wagtail.sites", "wagtail.contrib.redirects", "wagtail.contrib.forms", + "wagtail.contrib.search_promotions", "wagtail.contrib.sitemaps", "wagtail.contrib.routable_page", "wagtail", # Third-party apps "taggit", "modelcluster", - "django_social_share", # Puput apps "puput", "wagtailmarkdown", diff --git a/puput/abstracts.py b/puput/abstracts.py index 2fb50e2..3b6edb9 100644 --- a/puput/abstracts.py +++ b/puput/abstracts.py @@ -12,8 +12,8 @@ from wagtail.fields import RichTextField from modelcluster.contrib.taggit import ClusterTaggableManager from wagtailmarkdown.fields import MarkdownField -from colorful.fields import RGBColorField +from .fields import ColorField from .utils import get_image_model_path import markdown @@ -34,7 +34,7 @@ class BlogAbstract(models.Model): related_name="+", ) - main_color = RGBColorField(_("Blog Main Color"), default="#4D6AE0") + main_color = ColorField(_("Blog Main Color"), default="#4D6AE0") display_comments = models.BooleanField(default=False, verbose_name=_("Display comments")) display_categories = models.BooleanField(default=True, verbose_name=_("Display categories")) diff --git a/puput/fields.py b/puput/fields.py new file mode 100644 index 0000000..f702c63 --- /dev/null +++ b/puput/fields.py @@ -0,0 +1,17 @@ +from django.db import models + +from puput.widgets import ColorPickerWidget + + +class ColorField(models.CharField): + """ + A CharField which uses the HTML5 color picker widget. + """ + + def __init__(self, *args, **kwargs): + kwargs["max_length"] = 255 + super().__init__(*args, **kwargs) + + def formfield(self, **kwargs): + kwargs["widget"] = ColorPickerWidget + return super().formfield(**kwargs) diff --git a/puput/migrations/0005_blogpage_main_color.py b/puput/migrations/0005_blogpage_main_color.py index 52f06b4..8c7e250 100644 --- a/puput/migrations/0005_blogpage_main_color.py +++ b/puput/migrations/0005_blogpage_main_color.py @@ -2,7 +2,7 @@ # Generated by Django 1.11.4 on 2018-04-09 18:57 from __future__ import unicode_literals -import colorful.fields +import puput.fields from django.db import migrations @@ -16,6 +16,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='blogpage', name='main_color', - field=colorful.fields.RGBColorField(default='#4D6AE0', verbose_name='Blog Main Color'), + field=puput.fields.ColorField(default='#4D6AE0', verbose_name='Blog Main Color'), ), ] diff --git a/puput/routes.py b/puput/routes.py index 871dc28..a91f4d0 100644 --- a/puput/routes.py +++ b/puput/routes.py @@ -8,7 +8,13 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.models import Page -from wagtail.search.models import Query +import wagtail + +if wagtail.VERSION[:2] < (6, 0): + from wagtail.search.models import Query +else: + # https://docs.wagtail.org/en/stable/releases/6.0.html#query-model-moved-to-wagtail-contrib-search-promotions + from wagtail.contrib.search_promotions.models import Query from .utils import get_object_or_None diff --git a/puput/templates/puput/blog_page.html b/puput/templates/puput/blog_page.html index a0a7d69..ce8b75f 100644 --- a/puput/templates/puput/blog_page.html +++ b/puput/templates/puput/blog_page.html @@ -1,6 +1,6 @@ {% extends "puput/base.html" %} -{% load static i18n wagtailcore_tags wagtailimages_tags puput_tags social_share %} +{% load static i18n wagtailcore_tags wagtailimages_tags puput_tags %} {% block title %} {% if search_term %} @@ -69,16 +69,9 @@ {{ entry.body|richtext|truncatewords_html:70 }} {% endif %}