Skip to content

Commit

Permalink
Add django 4.2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Mar 7, 2024
1 parent 5b8dde5 commit 37b59e7
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 68 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ VE ?= ./ve
REQUIREMENTS ?= test_reqs.txt
SYS_PYTHON ?= python3
PY_SENTINAL ?= $(VE)/sentinal
WHEEL_VERSION ?= 0.33.6
PIP_VERSION ?= 20.0.2
WHEEL_VERSION ?= 0.42.0
PIP_VERSION ?= 24.0
MAX_COMPLEXITY ?= 8
PY_DIRS ?= $(APP)
DJANGO ?= "Django==3.2.13"
DJANGO ?= "Django==4.2.11"

FLAKE8 ?= $(VE)/bin/flake8
PIP ?= $(VE)/bin/pip
Expand Down
4 changes: 2 additions & 2 deletions pagetree/templates/pagetree/testblock.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{% load markup %}
{{pageblock.body|markdown}}
{% load markdownify %}
{{ pageblock.body|markdownify }}
50 changes: 25 additions & 25 deletions pagetree/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
from __future__ import unicode_literals

from django.conf.urls import include, url
from django.urls import include, re_path
from pagetree.generic.views import EditView, InstructorView, PageView

urlpatterns = [
url(r'^pagetree/', include('pagetree.urls')),
re_path(r'^pagetree/', include('pagetree.urls')),

# instantiate generic views using a template that doesn't
# extend/depend on base.html
url(r'^pages/edit/(?P<path>.*)$',
EditView.as_view(template_name="pagetree/test_page.html"),
{}, 'edit-page'),
url(r'^pages/instructor/(?P<path>.*)$',
InstructorView.as_view(template_name="pagetree/test_page.html")),
url(r'^pages/(?P<path>.*)$',
PageView.as_view(template_name="pagetree/test_page.html")),
re_path(r'^pages/edit/(?P<path>.*)$',
EditView.as_view(template_name="pagetree/test_page.html"),
{}, 'edit-page'),
re_path(r'^pages/instructor/(?P<path>.*)$',
InstructorView.as_view(template_name="pagetree/test_page.html")),
re_path(r'^pages/(?P<path>.*)$',
PageView.as_view(template_name="pagetree/test_page.html")),

# a second set to make sure non-default hierarchies
# get handled as well
url(r'^pages2/edit/(?P<path>.*)$',
EditView.as_view(
hierarchy_name="two",
hierarchy_base="/pages2",
template_name="pagetree/test_page.html"),
{}, 'edit-page'),
url(r'^pages2/instructor/(?P<path>.*)$',
InstructorView.as_view(
hierarchy_name="two",
hierarchy_base="/pages2",
template_name="pagetree/test_page.html")),
url(r'^pages2/(?P<path>.*)$',
PageView.as_view(
hierarchy_name="two",
hierarchy_base="/pages2",
template_name="pagetree/test_page.html")),
re_path(r'^pages2/edit/(?P<path>.*)$',
EditView.as_view(
hierarchy_name="two",
hierarchy_base="/pages2",
template_name="pagetree/test_page.html"),
{}, 'edit-page'),
re_path(r'^pages2/instructor/(?P<path>.*)$',
InstructorView.as_view(
hierarchy_name="two",
hierarchy_base="/pages2",
template_name="pagetree/test_page.html")),
re_path(r'^pages2/(?P<path>.*)$',
PageView.as_view(
hierarchy_name="two",
hierarchy_base="/pages2",
template_name="pagetree/test_page.html")),
]
62 changes: 31 additions & 31 deletions pagetree/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os.path

from django.conf.urls import url
from django.urls import re_path
import django.views.static

from pagetree.generic.views import CloneHierarchyView
Expand All @@ -17,37 +17,37 @@
media_root = os.path.join(os.path.dirname(__file__), "media")

urlpatterns = [
url(r'^media/(?P<path>.*)$', django.views.static.serve,
{'document_root': media_root}),
re_path(r'^media/(?P<path>.*)$', django.views.static.serve,
{'document_root': media_root}),
]

urlpatterns += [
url(r'^reorder_pageblocks/(?P<section_id>\d+)/$', reorder_pageblocks, {},
"reorder-pageblocks"),
url(r'^reorder_section_children/(?P<section_id>\d+)/$',
reorder_section_children, {}, "reorder-section-children"),
url(r'^section/add/(?P<section_id>\d+)/$', add_child_section, {},
"add-child-section"),
url(r'^section/move/(?P<section_id>\d+)/$', move_section, {},
"move-section"),
url(r'^pageblock/add/(?P<section_id>\d+)/$', add_pageblock, {},
"add-pageblock"),
url(r'^pageblock/edit/(?P<pageblock_id>\d+)/$', edit_pageblock, {},
"edit-pageblock"),
url(r'^pageblock/jsonexport/(?P<pageblock_id>\d+)/$',
export_pageblock_json, {}, "export-pageblock-json"),
url(r'^pageblock/jsonimport/(?P<pageblock_id>\d+)/$',
import_pageblock_json, {}, "import-pageblock-json"),
url(r'^delete_section/(?P<section_id>\d+)/$', delete_section, {},
"delete-section"),
url(r'^edit_section/(?P<section_id>\d+)/$', edit_section, {},
"edit-section"),
url(r'^delete_pageblock/(?P<pageblock_id>\d+)/$', delete_pageblock, {},
"delete-pageblock"),
url(r'^create_tree_root$', create_tree_root, {}, "create_tree_root"),
url(r'^export/$', exporter, {}, 'export-hierarchy'),
url(r'^version/(?P<version_id>\d+)/revert/$', revert_to_version, {},
"revert-to-version"),
url(r'^clone_hierarchy/(?P<hierarchy_id>\d+)/$',
CloneHierarchyView.as_view(), name="clone-hierarchy"),
re_path(r'^reorder_pageblocks/(?P<section_id>\d+)/$', reorder_pageblocks,
{}, "reorder-pageblocks"),
re_path(r'^reorder_section_children/(?P<section_id>\d+)/$',
reorder_section_children, {}, "reorder-section-children"),
re_path(r'^section/add/(?P<section_id>\d+)/$', add_child_section, {},
"add-child-section"),
re_path(r'^section/move/(?P<section_id>\d+)/$', move_section, {},
"move-section"),
re_path(r'^pageblock/add/(?P<section_id>\d+)/$', add_pageblock, {},
"add-pageblock"),
re_path(r'^pageblock/edit/(?P<pageblock_id>\d+)/$', edit_pageblock, {},
"edit-pageblock"),
re_path(r'^pageblock/jsonexport/(?P<pageblock_id>\d+)/$',
export_pageblock_json, {}, "export-pageblock-json"),
re_path(r'^pageblock/jsonimport/(?P<pageblock_id>\d+)/$',
import_pageblock_json, {}, "import-pageblock-json"),
re_path(r'^delete_section/(?P<section_id>\d+)/$', delete_section, {},
"delete-section"),
re_path(r'^edit_section/(?P<section_id>\d+)/$', edit_section, {},
"edit-section"),
re_path(r'^delete_pageblock/(?P<pageblock_id>\d+)/$', delete_pageblock, {},
"delete-pageblock"),
re_path(r'^create_tree_root$', create_tree_root, {}, "create_tree_root"),
re_path(r'^export/$', exporter, {}, 'export-hierarchy'),
re_path(r'^version/(?P<version_id>\d+)/revert/$', revert_to_version, {},
"revert-to-version"),
re_path(r'^clone_hierarchy/(?P<hierarchy_id>\d+)/$',
CloneHierarchyView.as_view(), name="clone-hierarchy"),
]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Used by readthedocs.org to build the documentation
Django>=3.2.14,<4
Django>=4.2.11,<5
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def main():
'django.contrib.contenttypes',
'django.contrib.sessions',
'pagetree',
'django_markwhat',
'django_jenkins',
'markdownify.apps.MarkdownifyConfig',
),
TEST_RUNNER='django.test.runner.DiscoverRunner',
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField',
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
install_requires=[
"Django",
"django-treebeard",
"Markdown",
"coverage",
"django-markwhat",
"django-bootstrap3",
"six",
"Markdown",
"django-markdownify",
],
scripts=[],
license="BSD",
Expand Down
8 changes: 5 additions & 3 deletions test_reqs.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
django-treebeard==4.7.1
Markdown>=2.6.11,<3
coverage==7.4.3
importlib-metadata<7.1 # for flake8
importlib-metadata==7.0.2 # for flake8
typing_extensions==4.10.0
zipp==3.17.0 # for flake8
flake8==7.0.0
django-jenkins==0.110.0
pep8==1.7.1
pyflakes==3.2.0
django-markwhat==1.6.2
Faker==24.0.0
factory_boy==3.3.0
six==1.16.0
pycodestyle==2.11.1
mccabe==0.7.0
python-dateutil==2.9.0.post0
text-unidecode==1.3

Markdown==3.5.2
django-markdownify==0.9.3
bleach==6.1.0

0 comments on commit 37b59e7

Please sign in to comment.