Commit graph

1068 commits

Author SHA1 Message Date
Jelmer
95664ef6ef
Merge pull request #623 from jazzband/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-06-18 12:27:25 +02:00
pre-commit-ci[bot]
cc3a2b78b3
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0)
- [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.16.0)
2024-06-17 17:39:52 +00:00
Jelmer
e35c72427b
Merge pull request #624 from ProtixIT/DescriptorWrapper-no-catch
Remove catching of `AttributeError` in `DescriptorWrapper`
2024-06-13 10:58:11 +02:00
Jelmer
4275f84e7c
Merge pull request #614 from ProtixIT/splitfield-notnone
Remove support for assigning `None` to a `SplitField`
2024-06-13 09:25:40 +02:00
Maarten ter Huurne
14cf1b0d40 Remove catching of AttributeError in DescriptorWrapper
This catch was introduced in #367, but subsequent discussion
in #370, #381 and #382 suggests that it wasn't the proper solution.

Now that `AbstractModelTrackerTests` is re-enabled and passing,
it becomes clear that `AttributeError` is no longer raised during
unit testing when using a recent Django version. Therefore I think
it is safe to remove the `try`/`except`.
2024-06-12 16:55:45 +02:00
Maarten ter Huurne
a6b0a2aff7 Fix and re-enable AbstractModelTrackerTests
There used to be a [bug in Django](https://code.djangoproject.com/ticket/30427)
that caused these tests to fail, according to the discussion of #370.
That bug was fixed in Django 4.0.

However, because the test model was using a `FieldTracker`
rather than a `ModelTracker`, all model-specific test cases
in `ModelTrackerTests` continued to fail.
2024-06-12 16:54:14 +02:00
Jelmer
324ea2bd25
Merge pull request #617 from jazzband/readme-update
Update README.rst
2024-05-14 08:21:54 +02:00
Jelmer
2d833de9fa
Merge pull request #615 from ProtixIT/deprecate-joinmanager
Deprecate `JoinManager` and `JoinManagerMixin`
2024-05-14 08:15:38 +02:00
jelmert
7d0f348cb5 Updated changelog to include 4.5.1 & 4.5.0 2024-05-03 15:20:48 +02:00
Jelmer
f20c3945ad
Merge pull request #618 from ProtixIT/joinqueryset-quoted
Remove `JoinQueryset.get_quoted_query()`
2024-05-02 12:52:23 +02:00
Maarten ter Huurne
2b2110f82e Remove JoinQueryset.get_quoted_query()
Pass the parameters to the DB API instead of quoting them ourselves.
2024-05-02 12:47:40 +02:00
Matt Seymour
ea5c2b845d
Update README.rst
Update readme.rst

Run tests section does not render on github correctly and this information
is available in docs.
2024-04-22 11:43:47 +01:00
Maarten ter Huurne
441618a790 Update manual to explain JoinQueryset instead of JoinManager 2024-04-17 17:28:25 +02:00
Maarten ter Huurne
1ca51a55ed Document deprecation of JoinManager in ChangeLog 2024-04-17 14:45:25 +02:00
Maarten ter Huurne
784bf50c09 Add deprecation warning to JoinManagerMixin 2024-04-17 14:45:16 +02:00
Jelmer
ba9ac5db81
Merge pull request #612 from ProtixIT/generate-custom-soft-delete-manager
Auto-generate manager implementation for `CustomSoftDelete`
2024-04-17 09:36:00 +02:00
Jelmer
06939835bc
Merge pull request #611 from ProtixIT/delete-keep_parents
Fix `SoftDeletableModel.delete()` forwarding positional args to superclass
2024-04-17 09:34:16 +02:00
Maarten ter Huurne
c2d6cb5021 Remove support for assigning None to a SplitField
This behavior wasn't documented and didn't fully work: it breaks
as soon as you try to save a model with a `None` value.
2024-04-16 08:05:13 +02:00
Maarten ter Huurne
512d0f1890 Avoid deprecated SoftDeletableModel.objects manager in tests
Use the `available_objects` manager instead.
2024-04-16 04:02:33 +02:00
Maarten ter Huurne
800961626a Move CustomSoftDeleteQuerySet to tests.models
The `CustomSoftDeleteQuerySet` class was the only code left in
the `test.managers` module, while it is not in fact a `Manager`.
2024-04-16 04:02:33 +02:00
Maarten ter Huurne
68a4c14c74 Auto-generate manager implementation for CustomSoftDelete
Besides requiring less code, this also allows the django-stubs
mypy plugin to automatically generate a type-annotated version
of the manager.

Unfortunately, the plugin does not put a `ClassVar` annotation
on `objects`, which is why we need the suppression.
2024-04-16 04:02:12 +02:00
Maarten ter Huurne
2d7139363c Fix SoftDeletableModel.delete() forwarding positional args to superclass
The `soft` argument was made keyword-only, to avoid conflicts with new
positional arguments that might be added to Django. It was already
conflicting with the `keep_parents` argument.

The `using` argument is now passed to the superclass positionally,
as otherwise it can overlap with `*args`, resulting in a `TypeError`
on calls where `keep_parents` is passed positionally.
2024-04-11 16:45:32 +02:00
Maarten ter Huurne
a86c14e4e7
Remove excerpt field workaround for South FakeORM (#610)
* Remove excerpt field workaround for South FakeORM

South FakeORM hasn't been supported since fda2d39e, but the workaround
introduced in 9147becf evaded deletion. The `NoRendered` model was
removed in 9df3df99, but with that model gone, the `no_excerpt_field`
argument became obsolete as well.

* Document removal of `no_excerpt_field` in changelog
2024-04-10 14:17:34 +02:00
Jelmer
0fcfc113af
Merge pull request #601 from ProtixIT/mypy-in-ci
Enable static type checks using mypy in CI
2024-04-10 08:33:05 +02:00
Maarten ter Huurne
c75e54a1b8 Add mypy environment to tox configuration 2024-04-05 17:16:44 +02:00
Maarten ter Huurne
2f58a1160d Add minimal type annotations to make mypy pass
Avoid using `Self` as a type argument: for some reason this fails
when mypy has an empty cache, but passes when the cache has been
filled. Maybe it's a weird interaction between the mypy core and
the django-stubs plugin?
2024-04-05 17:16:06 +02:00
Maarten ter Huurne
441e3adee5 Make default port a string
Django can handle both strings and integers, but typeshed expects the
default value to match the mapping's value type.
2024-04-05 17:15:16 +02:00
Maarten ter Huurne
62cecfeb25 Suppress error about __version__ being None when not installed
Suppress rather than annotate, because people type checking against
`django-model-utils` will always have it installed and therefore
should not have to deal with `__version__` being `None`.
2024-04-05 17:15:16 +02:00
Maarten ter Huurne
f3335a7fe1 Add configuration for mypy
This does not require annotations yet, but it will check all code
outside of functions.
2024-04-05 17:15:16 +02:00
Maarten ter Huurne
07653f84f3 Add dependencies for static type checking 2024-04-05 17:12:35 +02:00
Guilherme Martins Crocetti
4c9d6eee13
feat(monitor): Change default to None when the field is marked as nullable and no default is provided (#599) 2024-04-04 10:26:17 +02:00
Jelmer
714632e8bf
Merge pull request #590 from foarsitter/unused_variable_levels
Levels variable is never set
2024-04-03 08:58:54 +02:00
Jelmer
53941ec7b4
Merge pull request #604 from ProtixIT/property-decorators
Modernize property definitions in `SplitText`
2024-04-03 08:54:31 +02:00
Maarten ter Huurne
d320924383
Forward additional arguments to contribute_to_class() to Django (#605)
* Pass additional arguments to superclass `contribute_to_class()`

In Django 3.2 there is an additional argument `private_only` and more
could be added in future versions.
2024-04-03 08:53:52 +02:00
Jelmer
23ea25a3ca
Merge pull request #606 from ProtixIT/keyword-only-cleanup
Modernize the way some keyword-only arguments are implemented
2024-04-03 08:53:09 +02:00
Jelmer
89653b2d24
Merge pull request #607 from ProtixIT/cleanup-factory
Minor cleanup of the code handling `UrlsafeTokenField`'s `factory` argument
2024-04-03 08:52:26 +02:00
Jelmer
9e71a46552
Merge pull request #608 from jazzband/translations
Updated translation files
2024-04-01 21:04:00 +02:00
Jelmer Draaijer
c6d686e418 Translation files 2024-04-01 15:09:46 +02:00
Maarten ter Huurne
6c5ed66ef2 Use callable() builtin function over isinstance(..., Callable)
This is slightly more compact, but the main motivation is to work
around the following mypy bug:

https://github.com/python/mypy/issues/3060
2024-03-26 14:09:03 +01:00
Maarten ter Huurne
e34de65480 Fix error message of UrlsafeTokenField's factory arg check 2024-03-26 14:08:49 +01:00
Maarten ter Huurne
d8c43eab46 Add tracker to method signatures in FieldTrackerTestCase 2024-03-26 13:56:39 +01:00
Maarten ter Huurne
6c920508c1 Use keyword-only arguments to simplify a few __init__() methods
Keyword-only arguments can be used now that Python 2 is no longer
supported.
2024-03-26 13:53:02 +01:00
Maarten ter Huurne
d1325d1d5b Modernize property definitions in SplitText 2024-03-26 12:11:09 +01:00
Jelmer
994d6c1c42
Merge pull request #600 from foarsitter/issue-manager
Add issue-manager
2024-03-25 19:22:37 +01:00
Jelmer
ab7996dbeb
Merge pull request #602 from jazzband/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-03-25 19:22:11 +01:00
Jelmer
8bef73cd99
Merge pull request #563 from foarsitter/docker_postgresql
Postgresql docker container for local development
2024-03-25 19:06:28 +01:00
pre-commit-ci[bot]
c7f61f6418
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2)
2024-03-25 17:37:33 +00:00
Jelmer Draaijer
c380b3bad6 Add issue-manager.yml 2024-03-25 08:35:25 +01:00
Jelmer
87a9466afa
Merge pull request #598 from ProtixIT/remove-obsolete-test-models
Remove obsolete test models
2024-03-22 21:28:03 +01:00
Jelmer
fc49c636a9
Merge pull request #597 from ProtixIT/remove-signal-test-helper
Remove obsolete `tests.signals` module
2024-03-22 21:27:13 +01:00