-
Notifications
You must be signed in to change notification settings - Fork 11
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
Updates for compatibility with django 4.0+ #12
Open
rlskoeser
wants to merge
16
commits into
LibraryOfCongress:master
Choose a base branch
from
rlskoeser:django-updates
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
69b002d
Revise list of python versions for tox
rlskoeser 6db5019
Use updated django url/path syntax
rlskoeser 1dc6bc2
Update for django 4.0+ compatibility
rlskoeser 2a10d68
Address indentation flagged by flake8
rlskoeser 8ffa1c2
Update tox.ini
rlskoeser ac59ae5
Allow a wider range of django versions
rlskoeser 587a090
Add basic github actions unit test with build matrix
rlskoeser 46e01d7
Remove import error checks for older versions of django
rlskoeser ca879c2
Exclude incompatible python/django combinations from build matrix
rlskoeser 813a547
Disable tests that are failing/erroring
rlskoeser 918543e
Fix nesting for matrix exclude directive
rlskoeser 37e7a71
Update action cache version
rlskoeser a6c6080
Update regex assert method name
rlskoeser a924afe
Switch the Django function used to prevent caching
acdha 6f3ee97
Add now-required template context processor
acdha db0a0c5
Remove now-unnecessary skip for the debug response test
acdha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: unit tests | ||
|
||
on: | ||
push: # run on every push or PR to any branch | ||
pull_request: | ||
schedule: # run automatically on main branch each Tuesday at 11am | ||
- cron: "0 16 * * 2" | ||
|
||
jobs: | ||
python-unit: | ||
name: Python unit tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: ["3.9", "3.10", "3.11", "3.12"] | ||
# current mainstream support is at 4.2 | ||
django: ["4.0", "4.1", "4.2", "5.0", "5.1"] | ||
exclude: | ||
# django 5.0 and 5.1 require python 3.10 minimum | ||
- python: "3.9" | ||
django: 5.0 | ||
- python: "3.9" | ||
django: 5.1 | ||
# django 4.0 only goes up to python 3.10 | ||
- python: "3.11" | ||
django: 4.0 | ||
- python: "3.12" | ||
django: 4.0 | ||
# django 4.1 only goes up to python 3.11 | ||
- python: "3.12" | ||
django: 4.1 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
# Base python cache on the hash of test requirements file | ||
# if the file changes, the cache is invalidated. | ||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: pip-${{ hashFiles('requirements-test.txt') }} | ||
restore-keys: | | ||
pip-${{ hashFiles('requirements-test.txt') }} | ||
|
||
- name: Install package with dependencies | ||
run: | | ||
pip install -q Django==${{ matrix.django }} | ||
pip install -r requirements-test.txt | ||
|
||
- name: Run python tests | ||
run: python tests/run_tests.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
django | ||
django>=4.0,<6.0 | ||
xlsxwriter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# encoding: utf-8 | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
from django.conf.urls import include, url | ||
from django.urls import path | ||
from django.contrib import admin | ||
|
||
urlpatterns = [ | ||
url(r'^admin/', include(admin.site.urls)), | ||
path("admin/", admin.site.urls), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[tox] | ||
envlist = py27, py35, py36 | ||
envlist = py39,py310,py311,py312 | ||
|
||
[testenv] | ||
setenv = | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The underlying problem here is probably that the form parameters which the Django admin interface expects has probably changed: it's generating a 302 redirect to the requested URL so the test code must be missing something basic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi both! @rlskoeser asked me to take a look at this.
The error message Django sends back here is "No action selected." You can check this with:
I notice that there's no action actually named
custom_export_to_csv_action
so maybe this is the intended behavior? While that is the same error message you get on form validation errors, I don't see any difference in the form params—the underlying Django code hasn't actually changed (Django 3.2.x, Django 5), and I can't get this test to succeed under Django 3.2 either.It seems correct to redirect with this error message unless an admin action with that exact name was registered, unless I am missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this, @blms.
@acdha let us know how you'd like to resolve this.