Commit graph

1055 commits

Author SHA1 Message Date
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
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
Maarten ter Huurne
9df3df99cf Remove obsolete NoRendered test model
The code under test was removed in fda2d39e, but this model remained.
2024-03-22 18:50:05 +01:00
Maarten ter Huurne
6c39b58cb4 Remove FeaturedManager and related obsolete test model code
The code under test was removed in 6ae66e01, but some of the test code
remained.
2024-03-22 18:43:45 +01:00
Jelmer
6e722b51b0
Merge pull request #596 from ProtixIT/status-test-model-naming
Resolve name clash among test models
2024-03-22 18:00:40 +01:00
Jelmer
aaf93c9d40
Merge pull request #595 from ProtixIT/skip-reason
Pass reason to `@skip` decorator
2024-03-22 18:00:03 +01:00
Jelmer
281c52013e
Merge pull request #594 from ProtixIT/joinmanager
Remove redundant definition of `JoinManager` from tests
2024-03-22 17:58:14 +01:00
Maarten ter Huurne
6f16488ef3 Remove tests.signals module
This module was support code for the `SaveSignalHandlingModel` tests.
That class got introduced in 5d6f8f4e and removed in 11f3a53b, but
the support code remained.
2024-03-22 17:53:59 +01:00
Maarten ter Huurne
ed4f04f282 Resolve name clash among test models
There were two classes named `StatusCustomManager`: the first is an
actual manager, the second a status model that uses a custom manager.
The latter is renamed to `CustomManagerStatusModel` in this commit.
2024-03-22 17:32:51 +01:00
Maarten ter Huurne
ab8a8ae53a Pass reason to @skip decorator
The decorator works without an argument as well, but that is an
undocumented feature of `unittest.skip()` that is not understood
by mypy and pytest.

In the case of pytest, it ignored the decorated class during test
collection, instead of collecting it and marking it as skipped.
2024-03-22 16:58:09 +01:00
Maarten ter Huurne
b7677161cb Remove redundant definition of JoinManager from tests
The `JoinManager` class already exists in `model_utils.managers`,
with the exact same definition.
2024-03-22 16:29:37 +01:00
Jelmer
1e481c4a45
Merge pull request #593 from foarsitter/use_tz
USE_TZ = True
2024-03-22 16:27:59 +01:00
Jelmer Draaijer
1979d4796f USE_TZ = True 2024-03-22 16:13:29 +01:00
Jelmer
26336b41f6
Merge pull request #510 from adamchainz/time_machine
Switch from freezegun to time-machine.
2024-03-22 15:46:19 +01:00
Jelmer
d51f5c75c8
Merge pull request #591 from ProtixIT/explicit-reexport
Explicitly re-export names from `__init__` module
2024-03-22 15:44:16 +01:00