Skip to content

Prepare for Django 5.x support #235

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 1 commit into from
Feb 7, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| :memo: | **License** | [![License](https://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) |
| :package: | **PyPi** | [![PyPi](https://badge.fury.io/py/django-postgres-extra.svg)](https://pypi.python.org/pypi/django-postgres-extra) |
| :four_leaf_clover: | **Code coverage** | [![Coverage Status](https://coveralls.io/repos/github/SectorLabs/django-postgres-extra/badge.svg?branch=coveralls)](https://coveralls.io/github/SectorLabs/django-postgres-extra?branch=master) |
| <img src="https://cdn.iconscout.com/icon/free/png-256/django-1-282754.png" width="22px" height="22px" align="center" /> | **Django Versions** | 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2 |
| <img src="https://cdn.iconscout.com/icon/free/png-256/django-1-282754.png" width="22px" height="22px" align="center" /> | **Django Versions** | 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0 |
| <img src="https://cdn3.iconfinder.com/data/icons/logos-and-brands-adobe/512/267_Python-512.png" width="22px" height="22px" align="center" /> | **Python Versions** | 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 |
| <img src="https://pbs.twimg.com/profile_images/1152122059/psycopg-100_400x400.png" width="22px" height="22px" align="center" /> | **Psycopg Versions** | 2, 3 |
| :book: | **Documentation** | [Read The Docs](https://django-postgres-extra.readthedocs.io/en/master/) |
Expand Down
11 changes: 9 additions & 2 deletions psqlextra/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@ def rename_annotations(self, annotations) -> None:
new_annotations[new_name or old_name] = annotation

if new_name and self.annotation_select_mask:
self.annotation_select_mask.discard(old_name)
self.annotation_select_mask.add(new_name)
# It's a set in all versions prior to Django 5.x
# and a list in Django 5.x and newer.
# https://github.com/django/django/commit/d6b6e5d0fd4e6b6d0183b4cf6e4bd4f9afc7bf67
if isinstance(self.annotation_select_mask, set):
self.annotation_select_mask.discard(old_name)
self.annotation_select_mask.add(new_name)
elif isinstance(self.annotation_select_mask, list):
self.annotation_select_mask.remove(old_name)
self.annotation_select_mask.append(new_name)

self.annotations.clear()
self.annotations.update(new_annotations)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def run(self):
],
python_requires=">=3.6",
install_requires=[
"Django>=2.0,<5.0",
"Django>=2.0,<6.0",
"python-dateutil>=2.8.0,<=3.0.0",
],
extras_require={
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist =
{py36,py37}-dj{20,21,22,30,31,32}-psycopg{28,29}
{py38,py39,py310}-dj{21,22,30,31,32,40}-psycopg{28,29}
{py38,py39,py310,py311}-dj{41}-psycopg{28,29}
{py38,py39,py310,py311}-dj{42}-psycopg{28,29,31}
{py310,py311}-dj{42,50}-psycopg{28,29,31}

[testenv]
deps =
Expand All @@ -16,6 +16,7 @@ deps =
dj40: Django~=4.0.0
dj41: Django~=4.1.0
dj42: Django~=4.2.0
dj50: Django~=5.0.1
psycopg28: psycopg2[binary]~=2.8
psycopg29: psycopg2[binary]~=2.9
psycopg31: psycopg[binary]~=3.1
Expand Down