Skip to content

Commit

Permalink
Merge branch 'master' into chore-update-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
csalom committed May 22, 2024
2 parents 97f84d6 + 7e733ca commit a65b83b
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
* Yed Podtrzitko
* Francisco Fernández
* Pep Lluís Miró
* Wesley van Lee
* Marco Badan
15 changes: 10 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -106,7 +111,7 @@ Changelog
* Add German and Polish translations.

0.9.1 (2017-09-12)
------------------
----------------
* Add missing migration.

0.9 (2017-08-03)
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
7 changes: 2 additions & 5 deletions docs/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
)
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion puput/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions puput/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"))
Expand Down
17 changes: 17 additions & 0 deletions puput/fields.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions puput/migrations/0005_blogpage_main_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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'),
),
]
8 changes: 7 additions & 1 deletion puput/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 3 additions & 10 deletions puput/templates/puput/blog_page.html
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down Expand Up @@ -69,16 +69,9 @@
{{ entry.body|richtext|truncatewords_html:70 }}
{% endif %}
<div class="row">
{% canonical_url entry as share_url %}
<ul class="social-share col-md-9">
<li class="social-item">
{% post_to_facebook post_url '<span><i class="fa fa-facebook"></i></span>' %}
</li>
<li class="social-item">
{% post_to_twitter entry.title post_url '<span><i class="fa fa-twitter"></i></span>' %}
</li>
<li class="social-item">
{% post_to_linkendin post_url '<span><i class="fa fa-linkedin"></i></span>' %}
</li>
{% include 'puput/share_links.html' with share_url=share_url entry=entry only %}
</ul>
<div class="col-md-3">
<a class="blog_btn continue" href="{{ post_url }}">{% trans 'Continue reading' %} &raquo;</a>
Expand Down
2 changes: 2 additions & 0 deletions puput/templates/puput/entry_links.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{% load wagtailroutablepage_tags puput_tags %}

<ul class="links">
{% if entry.owner %}
<li>
<i class="fa fa-user"></i>
<a href="{% routablepageurl blog_page 'entries_by_author' entry.owner.username %}">
{{ entry.owner.username }}
</a>
</li>
{% endif %}
<li>
<i class="fa fa-calendar"></i>
{{ entry.date|date:"DATE_FORMAT" }}
Expand Down
14 changes: 3 additions & 11 deletions puput/templates/puput/entry_page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "puput/base.html" %}
{% load i18n wagtailcore_tags wagtailimages_tags puput_tags social_share %}
{% load i18n wagtailcore_tags wagtailimages_tags puput_tags %}

{% block title %}
{{ self.title }} | {{ blog_page.title }}
Expand Down Expand Up @@ -62,17 +62,9 @@
<i class="fa fa-angle-left"></i> {% trans 'Return' %}
</a>
</div>
{% entry_url self blog_page as post_url %}
{% canonical_url self as share_url %}
<ul class="social-share-all text-right col-md-10">
<li class="social-item">
{% post_to_facebook post_url '<span><i class="fa fa-facebook"></i></span>' %}
</li>
<li class="social-item">
{% post_to_twitter self.title post_url '<span><i class="fa fa-twitter"></i></span>' %}
</li>
<li class="social-item">
{% post_to_linkendin post_url '<span><i class="fa fa-linkedin"></i></span>' %}
</li>
{% include 'puput/share_links.html' with share_url=share_url entry=self only %}
</ul>
</div>

Expand Down
21 changes: 21 additions & 0 deletions puput/templates/puput/share_links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<li class="social-item">
<div class="facebook-this">
<a href="https://www.facebook.com/sharer/sharer.php?u={{ share_url }}" target="_blank">
<span><i class="fa fa-facebook"></i></span>
</a>
</div>
</li>
<li class="social-item">
<div class="tweet-this">
<a href="https://twitter.com/share?url={{ share_url }}&text={{ entry.title }}" class="meta-act-link meta-tweet" target="_blank">
<span><i class="fa fa-twitter"></i></span>
</a>
</div>
</li>
<li class="social-item">
<div class="linkedin-this">
<a class="box-social" href="https://www.linkedin.com/shareArticle?url={{ share_url }}&title={{ entry.title }}&summary={{ entry.search_description }}" target="_blank">
<span><i class="fa fa-linkedin"></i></span>
</a>
</div>
</li>
3 changes: 0 additions & 3 deletions puput/templates/puput/tags/post_to_linkedin.html

This file was deleted.

18 changes: 0 additions & 18 deletions puput/templatetags/puput_tags.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.template import Library
from django.urls import resolve
from django.template.defaultfilters import urlencode
from django.template.loader import render_to_string
from django_social_share.templatetags.social_share import _build_url
from el_pagination.templatetags.el_pagination_tags import show_pages, paginate

from ..conf import settings
Expand Down Expand Up @@ -109,19 +107,3 @@ def show_comments(context):
# Avoid to import endless_pagination in installed_apps and in the templates
register.tag("show_paginator", show_pages)
register.tag("paginate", paginate)


@register.simple_tag(takes_context=True)
def post_to_linkendin_url(context, obj_or_url=None):
request = context.get("request")
if request:
url = _build_url(request, obj_or_url)
context["linkendin_url"] = "https://www.linkedin.com/shareArticle?url={}".format(urlencode(url))
return context


@register.inclusion_tag("puput/tags/post_to_linkedin.html", takes_context=True)
def post_to_linkendin(context, obj_or_url=None, link_text="Post to LinkedIn"):
context = post_to_linkendin_url(context, obj_or_url)
context["link_text"] = link_text
return context
5 changes: 5 additions & 0 deletions puput/widgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django import forms


class ColorPickerWidget(forms.TextInput):
input_type = "color"
12 changes: 6 additions & 6 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pytest==7.1.2
pytest-django==4.1.0
requests==2.31.0
model-bakery==1.5.0
ipdb==0.13.9
tox==3.27.1
pytest==8.0.0
pytest-django==4.8.0
requests==2.32.0
model-bakery==1.17.0
ipdb==0.13.13
tox==4.12.1
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ def get_metadata(package, field):
description='A Django blog app implemented in Wagtail.',
long_description=codecs.open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8').read(),
install_requires=[
'Django>=3.2,<4.3',
'wagtail>=4.0,<5.1',
'wagtail>=5.2,<7.0',
'django-el-pagination==4.0.0',
'django-social-share>=1.3.0',
'django-colorful>=1.3',
'django-taggit>=3.1.0,<4.1',
'wagtail-markdown==0.11.0'
'wagtail-markdown==0.11.1'
],
url='http://github.com/APSL/puput',
author=get_metadata('puput', 'author'),
Expand All @@ -40,17 +37,18 @@ def get_metadata(package, field):
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Wagtail',
'Framework :: Wagtail :: 5',
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: OS Independent',
'Topic :: Software Development'
]
Expand Down
Loading

0 comments on commit a65b83b

Please sign in to comment.