Benedikt Willi
c75b23765a
Removed unnecessary type ignore comments, dropped outdated Python and Django versions, and adjusted type ignores in the test suite.
2025-12-15 17:23:36 +01:00
jelmert
2ad921c04d
Model.save keyword only
2025-04-08 09:55:41 +02:00
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
Maarten ter Huurne
23a756e13e
Annotate test_fields package
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
8f0b4ee2f8
Suppress mypy errors in field tracker tests
...
I can't find a way to inform mypy of the actual types without
duplicating a lot of test code.
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
7d6cad0200
Annotate test_field_tracker module
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
23f1811b9d
Annotate return type of test methods
2024-06-13 12:02:05 +02:00
Maarten ter Huurne
aeeb69a9dd
Enable postponed evaluation of annotations for all test 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
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
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
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
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
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
Maarten ter Huurne
d8c43eab46
Add tracker to method signatures in FieldTrackerTestCase
2024-03-26 13:56:39 +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
Jelmer
26336b41f6
Merge pull request #510 from adamchainz/time_machine
...
Switch from freezegun to time-machine.
2024-03-22 15:46:19 +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
joeriddles
103c942ca5
Fix docstring for prefetch_related test class
2023-01-26 14:25:43 -08:00
joeriddles
604c6f0b62
Remove unnecessary model and simplify tests for prefetch_related
2023-01-26 14:25:09 -08:00
joeriddles
a0624f1492
For error on prefetch_related for tracked field
2023-01-26 13:17:49 -08:00
Adam Johnson
262ac384ac
explicit timezones
2022-04-04 12:04:38 +01:00
Adam Johnson
8edd7c00fc
Switch from freezegun to time-machine.
...
It’s [more accurate](https://adamj.eu/tech/2020/06/03/introducing-time-machine/ ) and [faster](https://adamj.eu/tech/2021/02/19/freezegun-versus-time-machine/ ).
2022-04-04 11:53:18 +01:00
Matthieu Rigal
6d4112e8ce
Fix performance regression: avoid pickling the whole instance when deepcopying fields on Django 3.1+ ( #500 )
...
* test: Add failing test for #gh-498
* fix: Fix performance regression on FileTracker for FileField on Django 3.1+
2021-10-09 21:30:12 +06:00
Sergey Tikhonov
79a7793dc5
#491 Context manager for resetting fields ( #494 )
...
* Add tracker context manager and decorator
* Handle auto-field warning in tests
* Use tracker context in monkey-patched methods
* Test delaying set_saved_fields call with context manager
* Docs for tracker context
* Describe FieldsContext context manager in changes
* Fix unused import
* #494 add breaking changes note on 4.1.1 release for #404
* #494 fix typo
* #494 add docstring for FieldsContext
* #494 move breaking changes from 4.1.1 to 4.1.0
* #494 fix typo and add some more docstrings
2021-10-08 15:09:20 +06:00
Nafees Anwar
9deb39dc46
Added deconstruct
2021-04-30 21:40:39 +05:00
Nafees Anwar
a56d07cd68
Added urlsafe token field
2021-04-30 21:40:39 +05:00
David Smith
79ff8ea6be
Used isort to sort imports ( #460 )
2020-11-29 20:58:00 +00:00
Sergey Tikhonov
1386c379b7
FieldTracker should patch save_base instead of save ( #404 )
...
* add test for reproducing FieldTracker update_fields issue
FieldTracker does not see update_fields changed in tracked model.save() method
* Patch Model.save_base instead of save
This change allows proper capturing update_fields kwarg if is is changed in overridden save() method.
* Add some details about FieldTracker implementation
* Mention FieldTracker behavior change
2019-12-15 22:43:58 +06:00
Sergey Tikhonov
d756a4a8ce
patch Model.refresh_from_db in FieldTracker ( #403 )
...
* patch Model.refresh_from_db in FieldTracker
* add info about refresh_from_db patching to CHANGES.rst
2019-12-15 20:28:15 +06:00
Misha K
5aa40c66be
Add django 3.0 to the test matrix and drop six ( #395 )
...
* - add django 3.0 to the test matrix
- drop six
* add entry in CHANGES
* remove context kwarg
* fix test with DeferredAttribute
* rename StringyDescriptor's name to attname
* Fix flake8
* Drop support for Django 1.11 because the API are not compatibles anymore with Django 3.0
* Try to fix tests.
* Define model for the field mock.
* Simplifies the code.
* Properly mock the field.
* Typo
* Use the new API field name.
* Call it attname
* Grab the field instance from the model.
* Use postgres in travis tests.
* Django 2.0.1 minimum is needed.
* Update Changelog to tell about breaking Django 1.11.
* Update changelog to tell about Django 3.0 support.
* @natim review.
2019-12-09 19:37:16 +06:00
Adam Dobrawy
ffa1a85dc7
Modernize Python syntax, add Python 3.8 ( #398 )
...
* Modernize Python syntax, add Python 3.8
* Update Python version & dist in TravisCI
* Add postgresql as addon
* Switch to psycopg2-binary
* Drop django.utils.six
2019-11-14 22:50:04 +06:00
Hasan Ramezani
aa94194dbc
Drop Python 2 support. ( #394 )
2019-09-30 14:08:52 +06:00
Rémy HUBSCHER
e6c7b567d1
Remove unsupported django version hacks.
2019-08-21 11:02:23 +02:00
Eugene
7d9ebc1b49
Skip AbstractModelTrackerTests
...
https://github.com/jazzband/django-model-utils/pull/381
2019-08-20 19:00:25 +07:00
Eugene Kuznetsov
23148f481c
fix test case
2019-08-05 18:45:48 +07:00
Eugene Kuznetsov
a3bada7e54
fix test case
2019-08-05 18:44:46 +07:00
Asif Saif Uddin
25dde41418
Merge pull request #360 from marfyl/master
...
Add UUIDModel and UUIDField
2019-05-16 05:45:53 +06:00
Nick Sandford
d557c42533
Catch deferred attribute exception ( #367 )
2019-03-29 12:46:40 +06:00
JMP
fc523d5433
Add tdd to increase coverage
2019-03-20 21:51:31 +01:00
JMP
89fd5fff82
Catch exception in test
2019-02-26 19:19:32 +01:00
JMP
58e57d5535
UUIDField tests
2019-02-26 17:36:23 +01:00
Sergey Tikhonov
6b88c888d3
fix model.save patched in FieldTracker ( #353 )
...
* fix model.save patched in FieldTracker
* add test for save call with args
* update changes
2018-12-10 21:35:26 +06:00
tumb1er
ba83be0b43
fix #330 patch MyModel.save instead of MyModel().save
2018-11-20 18:32:09 +03:00
Lucas Wiman
0859508a64
Fix E123 closing bracket does not match indentation of opening bracket's line
2018-07-02 12:57:14 -07:00
Lucas Wiman
600ddc8dc5
Fix F401: imported but unused.
2018-07-02 12:16:41 -07:00
Lucas Wiman
f845dcb24c
Fix E231: missing whitespace after ",".
2018-07-02 11:49:16 -07:00
Lucas Wiman
654e13235e
Fix E303 too many blank lines.
2018-07-02 11:47:19 -07:00
Lucas Wiman
7d6b45f0c1
Increase coverage: verify that accessing the descriptor from the class yields the descriptor object.
2018-06-28 17:04:57 -07:00
Lucas Wiman
cde1d706af
Cover a branch in has_changed.
2018-06-28 14:08:03 -07:00
Lucas Wiman
5d410e9ccc
Fix test failures from merge.
2018-06-28 11:29:44 -07:00