Skip to content
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

Wagtail 6.1 #7

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ jobs:
build:
working_directory: ~/wagtailquickcreate
docker:
- image: circleci/python:3.8.0
- image: cimg/python:3.12.1
environment:
PIPENV_VENV_IN_PROJECT: true
DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
- image: circleci/postgres:9.6.2
- image: cimg/postgres:16.2
environment:
POSTGRES_USER: root
POSTGRES_DB: circle_test
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.8/site-packages
- run: sudo apt-get update && sudo apt-get install -y python3-pip
- run:
command: |
sudo pip install pipenv
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
matrix:
include:
- python: 3.9
wagtail: wagtail>=4.1
- python: 3.12
wagtail: wagtail>=5.2
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
packages=find_packages(exclude=['tests*']),
include_package_data=True,
install_requires=[
'wagtail>=4.1',
'wagtail>=5.2',
],
classifiers=[
'Environment :: Web Environment',
Expand All @@ -40,7 +40,7 @@
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Framework :: Wagtail',
'Framework :: Wagtail :: 4',
'Framework :: Wagtail :: 5',
'Framework :: Wagtail :: 6',
],
)
19 changes: 11 additions & 8 deletions wagtailquickcreate/templates/wagtailquickcreate/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

{% block content %}
<header class="w-header w-header--merged">
<div class="row row-flush">
<div class="col">
<h1 class="w-header__title">
<img src="{% avatar_url user %}" alt="" class="avatar"/>
Add {{ model_verbose_name }}
</h1>
<h2>{{ user.get_full_name|default:user.get_username }}</h2>
<div class="row">
<div class="left">
<div class="col">
<h1 class="w-header__title" id="header-title">
<div class="avatar"><img src="{% avatar_url user %}" alt="" /></div>
Add {{ model_verbose_name }}
<span class="w-header__subtitle">{{ user.get_full_name|default:user.get_username }}</span>
</h1>
</div>
</div>
</div>
</header>
Expand All @@ -28,7 +30,8 @@ <h2>{{ user.get_full_name|default:user.get_username }}</h2>

{% for page in parent_pages %}
<li>
<a href="/admin/pages/add/{{model_app|lower}}/{{page.model|lower}}/{{page.id}}/" class="icon icon-plus-inverse icon-larger">
<a href="/admin/pages/add/{{model_app|lower}}/{{page.model|lower}}/{{page.id}}/">
{% icon name="plus-inverse" classname="default w-mr-1 w-align-middle" %}
{% for parent in page.ancestors %}
{% if not parent.is_root %}
{{ parent }} >
Expand Down
50 changes: 32 additions & 18 deletions wagtailquickcreate/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,53 @@


class WagtailQuickCreateTests(TestCase, WagtailTestUtils):
fixtures = ['wagtailquickcreate/tests/fixtures/test.json']
fixtures = ["wagtailquickcreate/tests/fixtures/test.json"]

def setUp(self):
super().setUp()
self.login()
self.home = Page.objects.get(pk=2)
self.index = IndexPage(
title='Section 1',
slug='section-1',
introduction='...'
)
self.index = IndexPage(title="Section 1", slug="section-1", introduction="...")
self.index_2 = IndexPage(
title='Section 2',
slug='section-2',
introduction='...'
title="Section 2", slug="section-2", introduction="..."
)
self.home.add_child(instance=self.index)
self.index.add_child(instance=self.index_2)

def test_admin(self):
response = self.client.get(reverse('wagtailadmin_home'))
response = self.client.get(reverse("wagtailadmin_home"))
self.assertEqual(response.status_code, 200)

def test_quickcreate_panel_links(self):
response = self.client.get('/admin/')
self.assertTrue('Add Image' in str(response.content))
self.assertTrue('Add Document' in str(response.content))
self.assertTrue('Add Information page' in str(response.content))
response = self.client.get("/admin/")
self.assertTrue("Add Image" in str(response.content))
self.assertTrue("Add Document" in str(response.content))
self.assertTrue("Add Information page" in str(response.content))

def test_first_level_index_page_in_shortcut_view(self):
response = self.client.get('/admin/quickcreate/create/standardpages/informationpage/')
self.assertContains(response, 'Home > <strong>Section 1</strong>', html=True)
response = self.client.get(
"/admin/quickcreate/create/standardpages/informationpage/"
)
self.assertContains(
response,
"Home >\n "
"\n "
"\n "
"<strong>Section 1</strong>",
)

def test_second_level_index_in_shortcut_view(self):
response = self.client.get('/admin/quickcreate/create/standardpages/informationpage/')
self.assertContains(response, 'Home > Section 1 > <strong>Section 2</strong>', html=True)
response = self.client.get(
"/admin/quickcreate/create/standardpages/informationpage/"
)
self.assertContains(
response,
"Home >\n "
"\n "
"\n "
"\n "
"Section 1 >\n "
"\n "
"\n "
"<strong>Section 2</strong>",
)