Skip to content

Integrate previous wagtail upgrades #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests

on:
pull_request:
branches: [master]
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
id: install-dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions

- name: Test with tox
id: test-with-tox
run: |
tox
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ __pycache__
.DS_Store

/test_robots.db
venv
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ user:
migrate:
@python testmanage.py migrate

tox-215:
tox -e py38-dj32-wt215

tox-216:
tox -e py38-dj32-wt216
tox-41:
tox -e py38-dj41-wt41

tox-3:
tox -e py38-dj40-wt30
tox-42:
tox -e py38-dj42-wt42

tox-4:
tox -e py38-dj40-wt40
tox -e py38-dj41-wt41
tox-50:
tox -e py38-dj42-wt50
Binary file modified docs/source/static/1_in_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/static/2_index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/static/3_create_edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/static/4_create_edit_condensed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/static/5_index_rule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 4 additions & 14 deletions robots/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import django
from six import u

from django.db import models
from django.utils.text import get_text_list
Expand All @@ -7,20 +7,10 @@
from modelcluster.models import ClusterableModel
from modelcluster.fields import ParentalKey

from robots.panels import WrappedInlinepanel
from wagtail.admin.panels import FieldPanel
from wagtail.models import Site

from wagtail import VERSION as WAGTAIL_VERSION
if WAGTAIL_VERSION >= (3, 0):
from wagtail.models import Site
from wagtail.admin.panels import FieldPanel
else:
from wagtail.core.models import Site
from wagtail.admin.edit_handlers import FieldPanel

if django.VERSION >= (3, 0):
from six import u
else:
from django.utils.six import u
from robots.panels import WrappedInlinepanel


class BaseUrl(models.Model):
Expand Down
19 changes: 5 additions & 14 deletions robots/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

from django.conf import settings

from wagtail import VERSION as WAGTAIL_VERSION
if WAGTAIL_VERSION >= (3, 0):
from wagtail.admin.panels import InlinePanel
else:
from wagtail.admin.edit_handlers import InlinePanel
from wagtail.admin.panels import InlinePanel


def WrappedInlinepanel(relation_name, heading='', label='',
Expand All @@ -26,15 +22,10 @@ def WrappedInlinepanel(relation_name, heading='', label='',
'new_card_header_text': new_card_header_text,
}
else:
if WAGTAIL_VERSION >= (2, 0):
defaults = {
'heading': heading,
'label': label,
}
else:
defaults = {
'label': label,
}
defaults = {
'heading': heading,
'label': label,
}

defaults.update(kwargs)
return klass(relation_name, **defaults)
2 changes: 1 addition & 1 deletion robots/test/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"wagtail.contrib.routable_page",
"wagtail.contrib.styleguide",
"wagtail.sites",
"wagtail.core",
"wagtail",
"taggit",
"rest_framework",
"django.contrib.admin",
Expand Down
2 changes: 1 addition & 1 deletion robots/test/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.core import urls as wagtail_urls
from wagtail import urls as wagtail_urls

urlpatterns = [
path("django-admin/", admin.site.urls),
Expand Down
18 changes: 4 additions & 14 deletions robots/views.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import django
from django.db.models import Q
from django.views.decorators.cache import cache_page
from django.views.generic import ListView
from django.urls import NoReverseMatch, reverse

from wagtail.contrib.sitemaps.views import sitemap
from wagtail.models import Site

from robots import settings
from robots.models import Rule

if django.VERSION[:2] >= (2, 0):
from django.urls import NoReverseMatch, reverse
else:
from django.core.urlresolvers import NoReverseMatch, reverse

from wagtail import VERSION as WAGTAIL_VERSION # noqa
if WAGTAIL_VERSION >= (3, 0):
from wagtail.models import Site
else:
from wagtail.core.models import Site

from wagtail.contrib.sitemaps.views import sitemap


class RuleList(ListView):
"""
Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
},
install_requires=[
'wagtail>=2.15',
'wagtail>=4.1',
],
classifiers=[
'Development Status :: 3 - Alpha',
Expand All @@ -33,16 +33,15 @@
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Wagtail :: 2',
'Framework :: Wagtail :: 3',
'Framework :: Django :: 4.2',
'Framework :: Wagtail :: 4',
'Framework :: Wagtail :: 5',
]
)
2 changes: 1 addition & 1 deletion testmanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def runtests():
try:
execute_from_command_line(argv)
finally:
from wagtail.tests.settings import STATIC_ROOT, MEDIA_ROOT
from wagtail.test.settings import STATIC_ROOT, MEDIA_ROOT

shutil.rmtree(STATIC_ROOT, ignore_errors=True)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
Expand Down
12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ skipsdist = True
usedevelop = True

envlist =
py{37}-dj{32}-wt{215,216}
py{38,39,310}-dj{32,40}-wt{216,30,40}
py{39,310}-dj{41}-wt{40,41}
py{38,39,310}-dj{32,41,42}-wt{41,42,50}
py{311}-dj{41,42}-wt{41,42,50}

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
deps = -r{toxinidir}/test-requirements.txt
Expand Down