-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
Fix Django 4 compatibility issues #778
Conversation
- add a shim around `get_extra_restriction` so that it works in versions of Django >=4 and <4 - fixes jazzband#776
taggit/managers.py
Outdated
# this is required to handle a change in Django 4.0 | ||
# https://docs.djangoproject.com/en/4.0/releases/4.0/#miscellaneous | ||
# the signature of the (private) funtion was changed | ||
if django.VERSION > (3, 8): |
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.
3, 8 or 3, 2?
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.
Ah, woops, should be (3, 2)
.
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.
Fixed this, I flipped it round to do < (4, 0)
instead.
Codecov Report
@@ Coverage Diff @@
## master #778 +/- ##
==========================================
+ Coverage 92.39% 92.46% +0.06%
==========================================
Files 9 9
Lines 697 703 +6
Branches 135 136 +1
==========================================
+ Hits 644 650 +6
Misses 35 35
Partials 18 18
Continue to review full report at Codecov.
|
Thanks @monty5811 👍
|
Looks good to me too, once we fix up the above comments! Thank you for sending this in 👍 |
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.
LGTM
Hi, when can we expect a new version including this fix to land in pypi? |
The
where_class
argument to the privateget_extra_restriction()
was changed in Django 4.0.A simple change is to remove the
where_class
argument here. But that breaks taggit on lower versions of django.To fix this, I added a shim that checks the django version and uses the correct function.
I have no idea if this is the best way to fix this, but the tests pass 🤷♂️
Relevant issue: #776
Note that this PR has a commit from #777 too.