Commit graph

35 commits

Author SHA1 Message Date
Guilherme Martins Crocetti
1673feae7b
chore: Replicate Django's signature at SoftDelete queryset 2024-08-28 10:41:31 -03:00
Maarten ter Huurne
949d110d04 Annotate the test_models package 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
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
Jelmer
26336b41f6
Merge pull request #510 from adamchainz/time_machine
Switch from freezegun to time-machine.
2024-03-22 15:46:19 +01:00
Maarten ter Huurne
a1530ad838 Update where ConnectionDoesNotExist is imported from
It was moved to a different package in Django 3.2.
2024-03-21 14:18:19 +01:00
Adam Johnson
11f3a53b0f Remove SaveSignalHandlingModel 2023-10-26 16:56:30 +01:00
Tim Gates
2dab8afded docs: Fix a few typos
There are small typos in:
- docs/managers.rst
- model_utils/managers.py
- tests/test_models/test_timestamped_model.py

Fixes:
- Should read `subclasses` rather than `subclasess`.
- Should read `queryset` rather than `querset`.
- Should read `permissible` rather than `permissable`.
- Should read `modified` rather than `modifed`.
- Should read `heterogeneous` rather than `heterogenous`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-08-17 22:37:49 +02: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
Hasan Ramezani
22cbfb6aeb
Rewrite test with subTest and remove parameterized from requirements-test. 2020-12-05 20:24:07 +01:00
Hasan Ramezani
f9fae60551
Remove duplicate test. 2020-12-05 20:13:04 +01:00
Hasan Ramezani
2269f810c8 Fix TypeError in save when model inherits from both TimeStampModel and StatusModel. (Fixes GH-465) 2020-12-02 00:07:22 +01:00
David Smith
79ff8ea6be
Used isort to sort imports (#460) 2020-11-29 20:58:00 +00:00
Hasan Ramezani
4ec3ecdade Fix flake8 errors. 2020-11-29 13:36:33 +01:00
Arseniy Panfilov
b302580283 use empty set instead of a dict for an 'empty set' test case 2020-10-15 15:51:33 +06:00
Arseniy Panfilov
fdd3af34d9 failing tests with different types of arguments for 'updated_fields' 2020-10-15 15:51:33 +06:00
H. Buğra Aydın
2ad67e77b1
Add status_changed field to upload_fields parameter during save if status field is present (#441)
* implementation/tests

* naming problem
2020-09-17 20:34:57 +06:00
Craig Anderson
b7a160936f Add available_objects soft deletable model manager. Emit deprecation warning when using objects soft deletable manager. 2020-08-25 16:40:09 +06:00
H. Buğra Aydın
3e32ae257b Overriding TimeStampedModel's save() method (#412)
* Overriding TimeStampedModel's save() method

to update modified field automatically when update_fields argument is used but modified was not given as a parameter.

* fixed a small error in logic

* added tests for new functionality
2020-01-23 13:19:06 +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
Rémy HUBSCHER
e6c7b567d1
Remove unsupported django version hacks. 2019-08-21 11:02:23 +02:00
Rémy HUBSCHER
1878537f25
Merge branch 'master' into bugfix/issue_109 2019-08-20 13:46:07 +02:00
asday
d9aa34e498 Fixed spacing.
Extraneous whitespace, too many blank lines, and too few blank
lines.
2019-08-19 22:38:05 +01:00
Emin Bugra Saral
5d6f8f4e9f Disable signals on save feature 2019-05-20 19:35:05 +02:00
JMP
c23c622d17 UUIDModel tests 2019-02-26 17:36:35 +01:00
Daniel Andrlik
25743141bc Ensure TimeStampedModel modified equals created on initial creation. (#319)
*  Ensure TimeStampedModel modified equals created on initial creation.

Add logic to AutoLastModifiedField which checks to see if the associated created field of the correct cField class type is also present. If the instance has not yet been saved (missing a pk), then set the value to modified to be equal to created.

Fixes #247

📚 Update changes and authors list related to changes.

* 🚑 Set TimeStampedModel modified to be equal to created during first save.

If instance does not yet have a pk, before defaulting the last modified to the current time, iterate over the the fields of the model, and instead use whatever value is found in the first occurance of the AutoCreatedField.

Fixes #247

* Move changelog up to unreleased section.
2018-12-08 12:23:04 +06:00
Lucas Wiman
954624cb22 Fix F841: local variable is assigned but never used. 2018-07-02 11:50:56 -07:00
Lucas Wiman
90ed7fc905 Improve coverage. 2018-06-21 12:41:42 -07:00
Lucas Wiman
80b099f129 Do not override custom descriptors when present.
This commit adds a collection of wrapper classes for tracking fields
while still using custom descriptors that may be present. This fixes
a bug where deferring a model field with a custom descriptor meant
that the descriptor was overridden in all subsequent queries.
2018-06-21 12:41:42 -07:00
Lucas Wiman
be52bc9290 Add failing test for deferred attributes. 2018-06-21 12:41:42 -07:00
Carl Meyer
198dcb612e Update github links for jazzband transfer. 2017-04-15 08:47:31 -07:00
Bruno Alla
10ebc16271 Exclude tests from distribution
fixes #258
2017-02-15 23:00:10 +00:00