Nick Prat
e777819073
Fixed an infinite recursion bug when deleting models related to a tracked model with a ForeignKey ( #620 )
...
* Fixed an infinite recursion bug when deleting a model, that has a reverse relationship to a tracked model with SET_NULL on_delete
---------
Co-authored-by: Napat Ch <napat@thevcgroup.com>
2025-04-03 19:58:57 +02:00
Guilherme Martins Crocetti
1673feae7b
chore: Replicate Django's signature at SoftDelete queryset
2024-08-28 10:41:31 -03:00
Maarten ter Huurne
5fc37eb4b4
Provide type arguments to field base classes
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
00937608fa
Add type argument to DescriptorWrapper
...
This preserves the type of the wrapped descriptor (usually a field).
Maybe this is overkill, as `DescriptorWrapper` seems to only be used
as part of the `FieldTracker` implementation and is not documented
and barely tested. But technically, it is public API.
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
1db7d6ba33
Fix type generics in InheritanceIterable
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
f4653f08e5
Preserve tracked function's return type in FieldTracker
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
ecc7312bf4
Override signature of query-returning methods in InheritanceManager
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
713a3fec88
Make type aliases compatible with old Python versions
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
2b0b4827a5
Annotate the choices module
...
The `Choices` constructor actually only accepts lists and tuples, not
arbitrary sequences. However, using `list` in the annotation opens
a can of worms related to type variance.
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
ebfb3455dc
Annotate the fields module
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
172cc72ec6
Annotate the models module
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
bde2d8f9a9
Annotate the managers module
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
56ea527286
Annotate the tracker module
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
0043fedf46
Enable postponed evaluation of annotations for all source modules
...
This allows using the latest annotation syntax supported by the type
checker regardless of the runtime Python version.
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
db9336031e
Call Field.get_default() instead of _get_default()
...
We can call the inherited public method using `super()` instead of
calling the private method directly.
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
04e152f879
Do not assume that default manager is named objects in join()
2024-06-13 12:02:05 +02: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
Jelmer
2d833de9fa
Merge pull request #615 from ProtixIT/deprecate-joinmanager
...
Deprecate `JoinManager` and `JoinManagerMixin`
2024-05-14 08:15:38 +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
Maarten ter Huurne
784bf50c09
Add deprecation warning to JoinManagerMixin
2024-04-17 14:45: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
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
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
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 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
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
Maarten ter Huurne
00e52e8508
Explicitly re-export names from __init__ module
...
Both mypy and flake8 understand `__all__`, removing the need for
warning suppression comments.
2024-03-22 14:50:31 +01:00
Guilherme Martins Crocetti
22015b8e69
chore(monitor-field): Add deprecation warning when the field is null and no default is provided. The new behavior will be introduced in a next major release
2024-03-21 20:05:14 -03:00
Jelmer Draaijer
ae562b45fb
Remove unused code
2024-03-21 16:52:14 +01:00
Jelmer
89b7662fa8
Merge pull request #567 from ProtixIT/remove-clone-args
...
Remove arguments from `InheritanceQuerySetMixin._clone()`
2024-03-21 15:33:02 +01:00
Jelmer
7b8a58b871
Merge pull request #580 from joecox/remove-dead-tracker-code
...
Remove dead `init_deferred_fields` method
2024-03-21 08:47:53 +01:00
Jelmer
f39c975e8b
Merge branch 'master' into ptbr-translations
2024-03-21 08:36:00 +01:00
meanmail
5663374890
Don't use post_init signal for initialize tracker
2024-03-11 17:50:12 +01:00
Joseph Riddle
55cd816939
Merge branch 'master' into fix-prefetch-related
2023-11-27 12:55:53 -08:00
Adam Johnson
11f3a53b0f
Remove SaveSignalHandlingModel
2023-10-26 16:56:30 +01:00
Joe Cox
b2a10bd96c
remove dead init_deferred_fields method
2023-09-11 16:25:16 -07:00
Guilherme Martins Crocetti
055932bb8b
feat(locale): Add translations for pt_BR
2023-08-01 11:26:41 -03:00
Serhii Tereshchenko
0ec4ac5e38
fix: Use proper column name instead of attname ( #573 )
...
fix: Use proper column name instead of attname
2023-06-16 15:34:47 +02:00
Jelmer
6916342126
Merge pull request #552 from patrick91/master
...
Add py.typed file
2023-06-16 11:46:15 +02:00