From 25072304d4a192eb83d17b10e07622f0d0aa5753 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 12:24:34 +0300 Subject: [PATCH 01/18] Support for Django 4 --- README.md | 22 +++++++++++----------- setup.py | 25 +++++++++++++------------ tox.ini | 10 ++++++---- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index adc20c3..53c3b4d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -| | | | -|--------------------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| | | | +|--------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | :white_check_mark: | **Tests** | [![CircleCI](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master.svg?style=svg)](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master) | -| :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | -| | **Django Versions** | 2.0, 2.1, 2.2, 3.0, 3.1, 3.2 | -| | **Python Versions** | 3.6, 3.7, 3.8, 3.9 | -| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | -| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) -| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) | +| :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | +| | **Django Versions** | 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0 | +| | **Python Versions** | 3.8, 3.9, 3.10, 3.11, 3.12 | +| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | +| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) +| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) | `django-localized-fields` is an implementation of a field class for Django models that allows the field's value to be set in multiple languages. It does this by utilizing the ``hstore`` type (PostgreSQL specific), which is available as `models.HStoreField` since Django 1.10. @@ -21,8 +21,8 @@ ### Prerequisites * PostgreSQL 10 or newer. -* Django 2.0 or newer. -* Python 3.6 or newer. +* Django 3.0 or newer. +* Python 3.8 or newer. ### Getting started diff --git a/setup.py b/setup.py index 52d8292..af3ad92 100644 --- a/setup.py +++ b/setup.py @@ -63,16 +63,17 @@ def run(self): "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ], - python_requires=">=3.6", + python_requires=">=3.8", install_requires=[ - "Django>=2.0", + "Django>=3.0,<5.0", "django-postgres-extra>=2.0,<3.0", "deprecation>=2.0.7", ], @@ -80,14 +81,14 @@ def run(self): ':python_version <= "3.6"': ["dataclasses"], "docs": ["Sphinx==2.2.0", "sphinx-rtd-theme==0.4.3"], "test": [ - "tox==3.14.3", - "pytest==5.3.2", - "pytest-django==3.7.0", - "pytest-cov==2.8.1", - "dj-database-url==0.5.0", - "django-autoslug==1.9.6", - "django-bleach==0.6.1", - "psycopg2==2.8.4", + "tox==4.15.0", + "pytest==8.2.1", + "pytest-django==4.8.0", + "pytest-cov==5.0.0", + "dj-database-url==2.2.0", + "django-autoslug==1.9.9", + "django-bleach==3.1.0", + "psycopg2==2.9.9", ], "analysis": [ "black==22.3.0", diff --git a/tox.ini b/tox.ini index 15dfab6..228f243 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,15 @@ [tox] -envlist = py36-dj{20,21,22,30,31}, py37-dj{20,21,22,30,31}, py38-dj{20,21,22,30,31}, py39-dj{21,22,30,31} +envlist = py39-dj{30,31,32,40,41,42}, py310-dj{30,31,32,40,41,42,50}, py311-dj{42,50}, py312-dj{42,50} [testenv] deps = - dj20: Django>=2.0,<2.1 - dj21: Django>=2.1,<2.2 - dj22: Django>=2.2,<2.3 dj30: Django>=3.0,<3.0.2 dj31: Django>=3.1,<3.2 + dj32: Django>=3.2,<4.0 + dj40: Django>=4.0,<4.1 + dj41: Django>=4.1,<4.2 + dj42: Django>=4.2,<5.0 + dj50: Django>=5.0,<5.1 .[test] setenv = DJANGO_SETTINGS_MODULE=settings From 8021bafffd1fcf53beac5379b6653065711466ea Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 12:26:10 +0300 Subject: [PATCH 02/18] Change pytest-django version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index af3ad92..9a9bc67 100644 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ def run(self): "test": [ "tox==4.15.0", "pytest==8.2.1", - "pytest-django==4.8.0", + "pytest-django==4.5.2", "pytest-cov==5.0.0", "dj-database-url==2.2.0", "django-autoslug==1.9.9", From f3504bad1d9c0218adcddef058e267c42ecc88db Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 12:36:13 +0300 Subject: [PATCH 03/18] Change psycopg2 version --- setup.py | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9a9bc67..b3bdc36 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def run(self): "dj-database-url==2.2.0", "django-autoslug==1.9.9", "django-bleach==3.1.0", - "psycopg2==2.9.9", + "psycopg2==2.9.8", ], "analysis": [ "black==22.3.0", diff --git a/tox.ini b/tox.ini index 228f243..c417289 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py39-dj{30,31,32,40,41,42}, py310-dj{30,31,32,40,41,42,50}, py311-dj{42,50}, py312-dj{42,50} +envlist = py38-dj{30,31,32,40,41,42}, py39-dj{30,31,32,40,41,42}, py310-dj{30,31,32,40,41,42,50}, py311-dj{42,50}, py312-dj{42,50} [testenv] deps = From 7f00dc5f156a1c9fe7465a4e31763d67936e8cd7 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 12:39:14 +0300 Subject: [PATCH 04/18] Change pytest version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b3bdc36..0bfe830 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ def run(self): "docs": ["Sphinx==2.2.0", "sphinx-rtd-theme==0.4.3"], "test": [ "tox==4.15.0", - "pytest==8.2.1", + "pytest==7.0.1", "pytest-django==4.5.2", "pytest-cov==5.0.0", "dj-database-url==2.2.0", From a3a0d494c8b5814c9fdd2f60e4111c4733715cfe Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 12:44:30 +0300 Subject: [PATCH 05/18] Change tox version --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0bfe830..4938222 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def run(self): setup( name="django-localized-fields", - version="6.8b3", + version="7.0b1", packages=find_packages(exclude=["tests"]), include_package_data=True, license="MIT License", @@ -81,7 +81,7 @@ def run(self): ':python_version <= "3.6"': ["dataclasses"], "docs": ["Sphinx==2.2.0", "sphinx-rtd-theme==0.4.3"], "test": [ - "tox==4.15.0", + "tox==3.28.0", "pytest==7.0.1", "pytest-django==4.5.2", "pytest-cov==5.0.0", From baa61e05400a5c3ea15e6ed09ab30851d9abe36b Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 13:14:40 +0300 Subject: [PATCH 06/18] Change pytest-cov version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4938222..fd2640e 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ def run(self): "tox==3.28.0", "pytest==7.0.1", "pytest-django==4.5.2", - "pytest-cov==5.0.0", + "pytest-cov==2.12.1", "dj-database-url==2.2.0", "django-autoslug==1.9.9", "django-bleach==3.1.0", From cb4ee45aad5a8949fbad2da508ac6196604fa0d7 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 13:24:38 +0300 Subject: [PATCH 07/18] Update circle ci jobs --- .circleci/config.yml | 86 ++++++++++++++++++++++++++++---------------- setup.py | 2 +- 2 files changed, 56 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e7a6f5..34dd4de 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,9 @@ version: 2 jobs: - test-python36: + + test-python38: docker: - - image: python:3.6-alpine + - image: python:3.8-alpine - image: postgres:11.0 environment: POSTGRES_DB: 'localizedfields' @@ -20,16 +21,16 @@ jobs: - run: name: Run tests - command: tox -e 'py36-dj{20,21,22,30,31}' + command: tox -e 'py38-dj{30,31,32,40,41,42}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' - store_test_results: path: reports - test-python37: + test-python39: docker: - - image: python:3.7-alpine + - image: python:3.9-alpine - image: postgres:11.0 environment: POSTGRES_DB: 'localizedfields' @@ -47,16 +48,16 @@ jobs: - run: name: Run tests - command: tox -e 'py37-dj{20,21,22,30,31}' + command: tox -e 'py39-dj{30,31,32,40,41,42}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' - store_test_results: path: reports - test-python38: + test-python310: docker: - - image: python:3.8-alpine + - image: python:3.10-alpine - image: postgres:11.0 environment: POSTGRES_DB: 'localizedfields' @@ -65,25 +66,24 @@ jobs: steps: - checkout - run: - name: Install packages - command: apk add postgresql-libs gcc musl-dev postgresql-dev git + name: Install packages + command: apk add postgresql-libs gcc musl-dev postgresql-dev git - run: - name: Install Python packages - command: pip install --progress-bar off .[test] + name: Install Python packages + command: pip install --progress-bar off .[test] - run: - name: Run tests - command: tox -e 'py38-dj{20,21,22,30,31}' - environment: - DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' + name: Run tests + command: tox -e 'py310-dj{30,31,32,40,41,42,50}' + environment: + DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' - store_test_results: - path: reports - - test-python39: + path: reports + test-python311: docker: - - image: python:3.9-alpine + - image: python:3.11-alpine - image: postgres:11.0 environment: POSTGRES_DB: 'localizedfields' @@ -92,25 +92,50 @@ jobs: steps: - checkout - run: - name: Install packages - command: apk add postgresql-libs gcc musl-dev postgresql-dev git + name: Install packages + command: apk add postgresql-libs gcc musl-dev postgresql-dev git - run: - name: Install Python packages - command: pip install --progress-bar off .[test] + name: Install Python packages + command: pip install --progress-bar off .[test] - run: - name: Run tests - command: tox -e 'py39-dj{21,22,30,31}' - environment: - DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' + name: Run tests + command: tox -e 'py311-dj{42,50}' + environment: + DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' - store_test_results: - path: reports + path: reports + test-python312: + docker: + - image: python:3.12-alpine + - image: postgres:11.0 + environment: + POSTGRES_DB: 'localizedfields' + POSTGRES_USER: 'localizedfields' + POSTGRES_PASSWORD: 'localizedfields' + steps: + - checkout + - run: + name: Install packages + command: apk add postgresql-libs gcc musl-dev postgresql-dev git + + - run: + name: Install Python packages + command: pip install --progress-bar off .[test] + + - run: + name: Run tests + command: tox -e 'py312-dj{42,50}'' + environment: + DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' + - store_test_results: + path: reports analysis: docker: - - image: python:3.7-alpine + - image: python:3.8-alpine steps: - checkout - run: @@ -130,7 +155,6 @@ workflows: version: 2 build: jobs: - - test-python36 - test-python37 - test-python38 - test-python39 diff --git a/setup.py b/setup.py index fd2640e..c0b33a9 100644 --- a/setup.py +++ b/setup.py @@ -87,7 +87,7 @@ def run(self): "pytest-cov==2.12.1", "dj-database-url==2.2.0", "django-autoslug==1.9.9", - "django-bleach==3.1.0", + "django-bleach==0.9.0", "psycopg2==2.9.8", ], "analysis": [ From df831e8de25ef9f1b173d6abda05148df0c89166 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:07:34 +0300 Subject: [PATCH 08/18] Fix ci jobs --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 34dd4de..a88dd2c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -155,7 +155,9 @@ workflows: version: 2 build: jobs: - - test-python37 - test-python38 - test-python39 + - test-python310 + - test-python311 + - test-python312 - analysis From 43431ed74ae620212c67cc74cdb5113b0f0923c6 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:14:15 +0300 Subject: [PATCH 09/18] Update ci to postgres 12 --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a88dd2c..492d39c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: test-python38: docker: - image: python:3.8-alpine - - image: postgres:11.0 + - image: postgres:12.0 environment: POSTGRES_DB: 'localizedfields' POSTGRES_USER: 'localizedfields' @@ -31,7 +31,7 @@ jobs: test-python39: docker: - image: python:3.9-alpine - - image: postgres:11.0 + - image: postgres:12.0 environment: POSTGRES_DB: 'localizedfields' POSTGRES_USER: 'localizedfields' @@ -58,7 +58,7 @@ jobs: test-python310: docker: - image: python:3.10-alpine - - image: postgres:11.0 + - image: postgres:12.0 environment: POSTGRES_DB: 'localizedfields' POSTGRES_USER: 'localizedfields' @@ -84,7 +84,7 @@ jobs: test-python311: docker: - image: python:3.11-alpine - - image: postgres:11.0 + - image: postgres:12.0 environment: POSTGRES_DB: 'localizedfields' POSTGRES_USER: 'localizedfields' @@ -110,7 +110,7 @@ jobs: test-python312: docker: - image: python:3.12-alpine - - image: postgres:11.0 + - image: postgres:12.0 environment: POSTGRES_DB: 'localizedfields' POSTGRES_USER: 'localizedfields' From 075393848661c52ca0cfc9258b75197ebc5d7bd1 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:16:00 +0300 Subject: [PATCH 10/18] Allow Django 5.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c0b33a9..8e243ce 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ def run(self): ], python_requires=">=3.8", install_requires=[ - "Django>=3.0,<5.0", + "Django>=3.0,<5.1", "django-postgres-extra>=2.0,<3.0", "deprecation>=2.0.7", ], From 9a718e7462c042e5a443526f3160370fe66313b8 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:30:09 +0300 Subject: [PATCH 11/18] Bump Django min version to 3.2 --- README.md | 6 +++--- setup.py | 2 +- tox.ini | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 53c3b4d..e957895 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | :white_check_mark: | **Tests** | [![CircleCI](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master.svg?style=svg)](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master) | | :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | -| | **Django Versions** | 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0 | +| | **Django Versions** | 3.2, 4.0, 4.1, 4.2, 5.0 | | | **Python Versions** | 3.8, 3.9, 3.10, 3.11, 3.12 | | :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | | :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) @@ -20,8 +20,8 @@ ## Working with the code ### Prerequisites -* PostgreSQL 10 or newer. -* Django 3.0 or newer. +* PostgreSQL 12 or newer. +* Django 3.2 or newer. * Python 3.8 or newer. ### Getting started diff --git a/setup.py b/setup.py index 8e243ce..037b325 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ def run(self): ], python_requires=">=3.8", install_requires=[ - "Django>=3.0,<5.1", + "Django>=3.2,<5.1", "django-postgres-extra>=2.0,<3.0", "deprecation>=2.0.7", ], diff --git a/tox.ini b/tox.ini index c417289..c773191 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,8 @@ [tox] -envlist = py38-dj{30,31,32,40,41,42}, py39-dj{30,31,32,40,41,42}, py310-dj{30,31,32,40,41,42,50}, py311-dj{42,50}, py312-dj{42,50} +envlist = py38-dj{32,40,41,42}, py39-dj{32,40,41,42}, py310-dj{32,40,41,42,50}, py311-dj{42,50}, py312-dj{42,50} [testenv] deps = - dj30: Django>=3.0,<3.0.2 - dj31: Django>=3.1,<3.2 dj32: Django>=3.2,<4.0 dj40: Django>=4.0,<4.1 dj41: Django>=4.1,<4.2 From 4022e9f8e057166661a74347acdddfc5062ab0bb Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:31:55 +0300 Subject: [PATCH 12/18] Fix CI to account for >= 3.2 requirement --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 492d39c..407a928 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,7 @@ jobs: - run: name: Run tests - command: tox -e 'py38-dj{30,31,32,40,41,42}' + command: tox -e 'py38-dj{32,40,41,42}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' @@ -48,7 +48,7 @@ jobs: - run: name: Run tests - command: tox -e 'py39-dj{30,31,32,40,41,42}' + command: tox -e 'py39-dj{32,40,41,42}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' @@ -75,7 +75,7 @@ jobs: - run: name: Run tests - command: tox -e 'py310-dj{30,31,32,40,41,42,50}' + command: tox -e 'py310-dj{32,40,41,42,50}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' From b1b076df1c997da0913358c153b84be7e3215e01 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:34:26 +0300 Subject: [PATCH 13/18] Fix quote --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 407a928..d7c122f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -127,7 +127,7 @@ jobs: - run: name: Run tests - command: tox -e 'py312-dj{42,50}'' + command: tox -e 'py312-dj{42,50}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' From 984ac56210503f6f7edcffcabe564cf4e98af934 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:42:52 +0300 Subject: [PATCH 14/18] Remove python 3.12 for now due to distutils removal --- .circleci/config.yml | 26 -------------------------- README.md | 16 ++++++++-------- setup.py | 1 - 3 files changed, 8 insertions(+), 35 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d7c122f..d723135 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,32 +107,7 @@ jobs: - store_test_results: path: reports - test-python312: - docker: - - image: python:3.12-alpine - - image: postgres:12.0 - environment: - POSTGRES_DB: 'localizedfields' - POSTGRES_USER: 'localizedfields' - POSTGRES_PASSWORD: 'localizedfields' - steps: - - checkout - - run: - name: Install packages - command: apk add postgresql-libs gcc musl-dev postgresql-dev git - - run: - name: Install Python packages - command: pip install --progress-bar off .[test] - - - run: - name: Run tests - command: tox -e 'py312-dj{42,50}' - environment: - DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' - - - store_test_results: - path: reports analysis: docker: - image: python:3.8-alpine @@ -159,5 +134,4 @@ workflows: - test-python39 - test-python310 - test-python311 - - test-python312 - analysis diff --git a/README.md b/README.md index e957895..dca191e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -| | | | -|--------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| | | | +|--------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | :white_check_mark: | **Tests** | [![CircleCI](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master.svg?style=svg)](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master) | -| :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | +| :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | | | **Django Versions** | 3.2, 4.0, 4.1, 4.2, 5.0 | -| | **Python Versions** | 3.8, 3.9, 3.10, 3.11, 3.12 | -| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | -| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) -| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) | +| | **Python Versions** | 3.8, 3.9, 3.10, 3.11 | +| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | +| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) +| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) | `django-localized-fields` is an implementation of a field class for Django models that allows the field's value to be set in multiple languages. It does this by utilizing the ``hstore`` type (PostgreSQL specific), which is available as `models.HStoreField` since Django 1.10. diff --git a/setup.py b/setup.py index 037b325..dc8f55f 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,6 @@ def run(self): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ], From 5d35136f38f3651864b4806fc9d419dbb321f903 Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 14:52:15 +0300 Subject: [PATCH 15/18] Remove Django upper bound --- setup.py | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index dc8f55f..62819b8 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ def run(self): ], python_requires=">=3.8", install_requires=[ - "Django>=3.2,<5.1", + "Django>=3.2", "django-postgres-extra>=2.0,<3.0", "deprecation>=2.0.7", ], diff --git a/tox.ini b/tox.ini index c773191..2b48277 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-dj{32,40,41,42}, py39-dj{32,40,41,42}, py310-dj{32,40,41,42,50}, py311-dj{42,50}, py312-dj{42,50} +envlist = py38-dj{32,40,41,42}, py39-dj{32,40,41,42}, py310-dj{32,40,41,42,50}, py311-dj{42,50} [testenv] deps = From 34330ddd1f8e41c878ab35419d230d8db3b435ff Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 15:06:39 +0300 Subject: [PATCH 16/18] Add back python3.6,3.7 wfs --- .circleci/config.yml | 57 ++++++++++++++++++++++++++++++++++++++++++-- README.md | 22 ++++++++--------- setup.py | 8 ++++--- tox.ini | 7 +++++- 4 files changed, 77 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d723135..75a342a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,57 @@ version: 2 jobs: + test-python36: + docker: + - image: python:3.6-alpine + - image: postgres:12.0 + environment: + POSTGRES_DB: 'localizedfields' + POSTGRES_USER: 'localizedfields' + POSTGRES_PASSWORD: 'localizedfields' + steps: + - checkout + - run: + name: Install packages + command: apk add postgresql-libs gcc musl-dev postgresql-dev git + - run: + name: Install Python packages + command: pip install --progress-bar off .[test] + + - run: + name: Run tests + command: tox -e 'py36-dj{20,21,22,30,31,32}' + environment: + DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' + + - store_test_results: + path: reports + test-python37: + docker: + - image: python:3.7-alpine + - image: postgres:12.0 + environment: + POSTGRES_DB: 'localizedfields' + POSTGRES_USER: 'localizedfields' + POSTGRES_PASSWORD: 'localizedfields' + steps: + - checkout + - run: + name: Install packages + command: apk add postgresql-libs gcc musl-dev postgresql-dev git + + - run: + name: Install Python packages + command: pip install --progress-bar off .[test] + + - run: + name: Run tests + command: tox -e 'py37-dj{20,21,22,30,31,32}' + environment: + DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' + + - store_test_results: + path: reports test-python38: docker: - image: python:3.8-alpine @@ -21,7 +72,7 @@ jobs: - run: name: Run tests - command: tox -e 'py38-dj{32,40,41,42}' + command: tox -e 'py38-dj{20,21,22,30,31,32,40,41,42}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' @@ -48,7 +99,7 @@ jobs: - run: name: Run tests - command: tox -e 'py39-dj{32,40,41,42}' + command: tox -e 'py39-dj{30,31,32,40,41,42}' environment: DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields' @@ -130,6 +181,8 @@ workflows: version: 2 build: jobs: + - test-python36 + - test-python37 - test-python38 - test-python39 - test-python310 diff --git a/README.md b/README.md index dca191e..49a9d19 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -| | | | -|--------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| | | | +|--------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | :white_check_mark: | **Tests** | [![CircleCI](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master.svg?style=svg)](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master) | -| :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | -| | **Django Versions** | 3.2, 4.0, 4.1, 4.2, 5.0 | -| | **Python Versions** | 3.8, 3.9, 3.10, 3.11 | -| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | -| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) -| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) | +| :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-localized-fields.svg)](https://pypi.python.org/pypi/django-localized-fields) | +| | **Django Versions** | 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0 | +| | **Python Versions** | 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 | +| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) | +| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0) +| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) | `django-localized-fields` is an implementation of a field class for Django models that allows the field's value to be set in multiple languages. It does this by utilizing the ``hstore`` type (PostgreSQL specific), which is available as `models.HStoreField` since Django 1.10. @@ -21,8 +21,8 @@ ### Prerequisites * PostgreSQL 12 or newer. -* Django 3.2 or newer. -* Python 3.8 or newer. +* Django 2.0 or newer. +* Python 3.6 or newer. ### Getting started diff --git a/setup.py b/setup.py index 62819b8..d624c9e 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def run(self): setup( name="django-localized-fields", - version="7.0b1", + version="6.8b4", packages=find_packages(exclude=["tests"]), include_package_data=True, license="MIT License", @@ -63,6 +63,8 @@ def run(self): "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -70,9 +72,9 @@ def run(self): "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ], - python_requires=">=3.8", + python_requires=">=3.6", install_requires=[ - "Django>=3.2", + "Django>=2.0", "django-postgres-extra>=2.0,<3.0", "deprecation>=2.0.7", ], diff --git a/tox.ini b/tox.ini index 2b48277..d931abe 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,13 @@ [tox] -envlist = py38-dj{32,40,41,42}, py39-dj{32,40,41,42}, py310-dj{32,40,41,42,50}, py311-dj{42,50} +envlist = py36-dj{20,21,22,30,31,32}, py37-dj{20,21,22,30,31,32}, py38-dj{20,21,22,30,31,32,40,41,42}, py39-dj{30,31,32,40,41,42}, py310-dj{32,40,41,42,50}, py311-dj{42,50} [testenv] deps = + dj20: Django>=2.0,<2.1 + dj21: Django>=2.1,<2.2 + dj22: Django>=2.2,<2.3 + dj30: Django>=3.0,<3.0.2 + dj31: Django>=3.1,<3.2 dj32: Django>=3.2,<4.0 dj40: Django>=4.0,<4.1 dj41: Django>=4.1,<4.2 From b2b2ff3ec6ca26688df13936d82f60d7ddde7c9e Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 15:11:20 +0300 Subject: [PATCH 17/18] Downgrade dj-database-url --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d624c9e..b076389 100644 --- a/setup.py +++ b/setup.py @@ -86,7 +86,7 @@ def run(self): "pytest==7.0.1", "pytest-django==4.5.2", "pytest-cov==2.12.1", - "dj-database-url==2.2.0", + "dj-database-url==0.5.0", "django-autoslug==1.9.9", "django-bleach==0.9.0", "psycopg2==2.9.8", From c1758defe13ded9d8d0ed436617f4914804fd49e Mon Sep 17 00:00:00 2001 From: tudorvaran Date: Fri, 31 May 2024 16:26:27 +0300 Subject: [PATCH 18/18] Fix isnull issue from Django 4 --- localized_fields/lookups.py | 4 +++ tests/test_isnull.py | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/test_isnull.py diff --git a/localized_fields/lookups.py b/localized_fields/lookups.py index 1536450..ba38980 100644 --- a/localized_fields/lookups.py +++ b/localized_fields/lookups.py @@ -43,6 +43,10 @@ def process_lhs(self, qn, connection): return super().process_lhs(qn, connection) def get_prep_lookup(self): + # Django 4.0 removed the ability for isnull fields to be something other than a bool + # We should NOT convert them to strings + if isinstance(self.rhs, bool): + return self.rhs return str(self.rhs) diff --git a/tests/test_isnull.py b/tests/test_isnull.py new file mode 100644 index 0000000..fb54e52 --- /dev/null +++ b/tests/test_isnull.py @@ -0,0 +1,51 @@ +import django +import pytest + +from django.test import TestCase + +from localized_fields.fields import LocalizedField +from localized_fields.value import LocalizedValue + +from .fake_model import get_fake_model + + +class LocalizedIsNullLookupsTestCase(TestCase): + """Tests whether ref lookups properly work with.""" + + TestModel1 = None + + @classmethod + def setUpClass(cls): + """Creates the test model in the database.""" + super(LocalizedIsNullLookupsTestCase, cls).setUpClass() + cls.TestModel = get_fake_model( + {"text": LocalizedField(null=True, required=[])} + ) + cls.TestModel.objects.create( + text=LocalizedValue(dict(en="text_en", ro="text_ro", nl="text_nl")) + ) + cls.TestModel.objects.create( + text=None, + ) + + def test_isnull_lookup_valid_values(self): + """Test whether isnull properly works with valid values.""" + assert self.TestModel.objects.filter(text__isnull=True).exists() + assert self.TestModel.objects.filter(text__isnull=False).exists() + + def test_isnull_lookup_null(self): + """Test whether isnull crashes with None as value.""" + + with pytest.raises(ValueError): + assert self.TestModel.objects.filter(text__isnull=None).exists() + + def test_isnull_lookup_string(self): + """Test whether isnull properly works with string values on the + corresponding Django version.""" + if django.VERSION < (4, 0): + assert self.TestModel.objects.filter(text__isnull="True").exists() + else: + with pytest.raises(ValueError): + assert self.TestModel.objects.filter( + text__isnull="True" + ).exists()