From a3e5636f5757f921450640e205b205f612d19ccc Mon Sep 17 00:00:00 2001 From: Konstantin Alekseev Date: Mon, 2 Oct 2023 10:26:09 +0300 Subject: [PATCH] Drop support for django < 4.2 --- .github/workflows/main.yml | 6 +----- CHANGELOG.md | 5 ++++- src/extra_checks/check_id.py | 2 +- src/extra_checks/checks/model_field_checks.py | 18 ------------------ tests/test_model_field_checks.py | 14 -------------- 5 files changed, 6 insertions(+), 39 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 69b1909..a8593f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,17 +21,13 @@ jobs: # https://github.com/actions/python-versions/blob/main/versions-manifest.json python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0-rc.3"] django-version: - - "Django>=3.2,<4.0" - - "Django>=4.1,<4.2" - "Django>=4.2,<5.0" - "Django>=5.0a1,<5.1" # - "https://github.com/django/django/archive/main.tar.gz" include: - drf: djangorestframework python-version: "3.11" - django-version: "Django<4.2,>=4.1" # must be different from django-version - - django-version: "Django<4.0,>=3.2" - python-version: 3.7 + django-version: "Django<5.0,>=4.2" # must be different from django-version exclude: - django-version: "Django>=5.0a1,<5.1" python-version: 3.8 diff --git a/CHANGELOG.md b/CHANGELOG.md index af403e5..4e1f268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ### Unreleased -- Drop python 3.6 support +- Remove `field-boolean-null` +- Deprecate `no-index-together` +- Drop support for python < 3.8 +- Drop support for django < 4.2 ### 0.13.3 diff --git a/src/extra_checks/check_id.py b/src/extra_checks/check_id.py index a0c7b0b..beadef3 100644 --- a/src/extra_checks/check_id.py +++ b/src/extra_checks/check_id.py @@ -15,7 +15,7 @@ class CheckId(str, enum.Enum): X053 = "field-help-text-gettext" X054 = "field-file-upload-to" X055 = "field-text-null" - X056 = "field-boolean-null" + # X056 = "field-boolean-null" - removed X057 = "field-null" X058 = "field-foreign-key-db-index" X059 = "field-default-null" diff --git a/src/extra_checks/checks/model_field_checks.py b/src/extra_checks/checks/model_field_checks.py index 86c2300..df15e82 100644 --- a/src/extra_checks/checks/model_field_checks.py +++ b/src/extra_checks/checks/model_field_checks.py @@ -163,24 +163,6 @@ def apply( ) -@registry.register(django.core.checks.Tags.models) -class CheckFieldNullBoolean(CheckModelField): - Id = CheckId.X056 - deprecation_warnings = [ - "`field-boolean-null` check is deprecated and will be removed in version 0.14.0" - ] - - def apply( - self, field: models.fields.Field, **kwargs: Any - ) -> Iterator[django.core.checks.CheckMessage]: - if isinstance(field, models.NullBooleanField): - yield self.message( - f'Field "{field.name}" should be `BooleanField` with attribute `null=True`.', - hint="Replace `NullBooleanField` by `BooleanField` with attribute `null=True`.", - obj=field, - ) - - @registry.register(django.core.checks.Tags.models) class CheckFieldNullFalse(CheckModelField): Id = CheckId.X057 diff --git a/tests/test_model_field_checks.py b/tests/test_model_field_checks.py index f9dfaaa..db271ae 100644 --- a/tests/test_model_field_checks.py +++ b/tests/test_model_field_checks.py @@ -70,20 +70,6 @@ def test_check_field_verbose_name_gettext_check_case(): assert not is_invalid("abc / def") -def test_check_field_null_boolean(test_case): - messages = ( - test_case.models(models.ModelFieldNullFalse) - .settings({"checks": [model_field_checks.CheckFieldNullBoolean.Id.value]}) - .check(model_field_checks.CheckFieldNullBoolean) - .run() - ) - assert len(messages) == 1 - assert messages[0].id == model_field_checks.CheckFieldNullBoolean.Id.name - assert {m.obj.name for m in messages} == { - "null_fail", - } - - def test_check_field_help_text_gettext(test_case): messages = ( test_case.settings(