Commit graph

242 commits

Author SHA1 Message Date
Hasan Ramezani
7af903b12a Add support for Django 3.2. 2021-04-07 10:32:50 +02:00
Simon Charette
f482042025 Add a release date for 4.1.1. 2020-12-01 18:12:57 -05: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
Simon Charette
b0be6e2422 Adjust CHANGES to mention 4.1.0 release and add missing changes. 2020-11-29 09:42:26 -05:00
Jannis Leidel
1b9e1fa435
Update changelog. 2020-11-29 14:53:42 +01:00
Hasan Ramezani
fed287e6fb Update test requirements. 2020-09-17 20:44:42 +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
Hasan Ramezani
b7770165d5 Add support for Django 3.1 2020-09-17 17:27:55 +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
Skia
33e46ebd53 managers: avoid querying too much tables when not needed
When calling `select_related()` with an empty list of arguments [1], Django will
try to prefetch some data by doing some first level joints with the related
classes.
This can lead to obvious negative performance impact, but this also breaks some
workarounds for having inheritance for foreign keys [2], as those solutions rely
on lazy evaluation of the related object.

[1]: a4e6030904/django/db/models/query.py (L1051)
     Only passing an explicit `None` to `select_related` will disable the magic.
[2]: https://github.com/jazzband/django-model-utils/issues/11

As examples, here are the generated SQL requests in
InheritanceManagerRelatedTests.test_get_method_with_select_subclasses_check_for_useless_join:

  * without this fix, without adding `.select_related(None)`
```sql
SELECT
    "tests_inheritancemanagertestparent"."id",
    "tests_inheritancemanagertestparent"."non_related_field_using_descriptor",
    "tests_inheritancemanagertestparent"."related_id",
    "tests_inheritancemanagertestparent"."normal_field",
    "tests_inheritancemanagertestparent"."related_self_id",
    "tests_inheritancemanagertestchild4"."other_onetoone_id",
    "tests_inheritancemanagertestchild4"."parent_ptr_id", T3."id",
    T3."non_related_field_using_descriptor", T3."related_id", T3."normal_field",
    T3."related_self_id"
FROM
    "tests_inheritancemanagertestchild4"
INNER JOIN
    "tests_inheritancemanagertestparent" ON
    ("tests_inheritancemanagertestchild4"."parent_ptr_id" = "tests_inheritancemanagertestparent"."id")
INNER JOIN
    "tests_inheritancemanagertestparent" T3 ON
    ("tests_inheritancemanagertestchild4"."other_onetoone_id" = T3."id")
WHERE
    "tests_inheritancemanagertestchild4"."parent_ptr_id" = 191
```

  * with either the fix, or by adding `.select_related(None)` after `.select_subclasses()`
```sql
SELECT
    "tests_inheritancemanagertestparent"."id",
    "tests_inheritancemanagertestparent"."non_related_field_using_descriptor",
    "tests_inheritancemanagertestparent"."related_id",
    "tests_inheritancemanagertestparent"."normal_field",
    "tests_inheritancemanagertestparent"."related_self_id",
    "tests_inheritancemanagertestchild4"."other_onetoone_id",
    "tests_inheritancemanagertestchild4"."parent_ptr_id"
FROM
    "tests_inheritancemanagertestchild4"
INNER JOIN
    "tests_inheritancemanagertestparent" ON
    ("tests_inheritancemanagertestchild4"."parent_ptr_id" = "tests_inheritancemanagertestparent"."id")
WHERE
    "tests_inheritancemanagertestchild4"."parent_ptr_id" = 191

```
2020-07-08 16:59:05 +06:00
Enrique Matías Sánchez (Quique)
4f7163bcf3 Add Spanish translation to changelog 2020-03-29 11:34:44 +02:00
H. Buğra Aydın
b0a6b78c80 added explanation for the new feature
i forgot to change changes file to explain the feature below, updating accordingly:

3e32ae257b
2020-03-02 16:46:09 +06:00
Martín Raúl Villalba
6fba04ec4f Satisfy deprecation warning under Django 3.0.3 2020-03-01 08:55:31 +06: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
Simon Charette
dd0d1bb01a
There's no 3.3.0 release. 2019-12-11 10:06:03 -05:00
Rémy HUBSCHER
35ba2bde31
Back to development 4.0.1 2019-12-11 15:48:26 +01:00
Rémy HUBSCHER
8af8cf269c
Prepare 4.0.0 release. 2019-12-11 15:47:18 +01: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
Hasan Ramezani
aa94194dbc Drop Python 2 support. (#394) 2019-09-30 14:08:52 +06:00
Rémy HUBSCHER
c19ea5b04f
Add changelog. 2019-08-21 11:19:13 +02:00
asday
488be3ff01 Updated documentation and bumped minor version. 2019-08-19 23:02:43 +01:00
Simon Charette
08e84eff69
Release 3.2.0. 2019-06-21 11:18:00 -04:00
Emin Bugra Saral
f5d4e5ce2b Update changes and authors 2019-05-20 19:45:51 +02: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
Remy Suen
c4a252d1fb Explain usage of timeframed model manager in the documentation (#365)
* Provide a sample for using the timeframed manager

Signed-off-by: Remy Suen <remy.suen@gmail.com>

* Update CHANGES.rst file

Signed-off-by: Remy Suen <remy.suen@gmail.com>

* Update AUTHORS.rst file

Signed-off-by: Remy Suen <remy.suen@gmail.com>
2019-03-20 15:07:00 +06:00
Skia
1b9b5ac2c1 managers: honor OneToOneField.parent_link=False (#363) 2019-03-12 23:29:02 +06:00
JMP
5c49f2c7d0 Update changes.rst for UUIDModel and UUIDField 2019-02-26 18:41:23 +01:00
Diego Navarro
4e18710537 Upgrades pytest, pytest-django and pytest-cov version to fix travis build (#358)
* Upgrades pytest, pytest-django and pytest-cov version

* Skips testing Python 3.5 with django trunk (Django 2.1 requires Python 3.6)
2019-02-22 00:05:35 +06:00
Zach Cheung
af1824e200 fix conflict 2019-01-11 17:26:06 +08: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
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
Guilherme Devincenzi
b739f6fe87 Add default manager as all_objects for SoftDeletableModel (#326)
* Add default manager as all_objects for SoftDeletableModel

* Document changes on changelog
2018-12-08 11:50:10 +06:00
Éric Araujo
764b7ea78d Add support for reverse iteration of Choices (#314) 2018-12-08 11:47:54 +06:00
tumb1er
ba83be0b43 fix #330 patch MyModel.save instead of MyModel().save 2018-11-20 18:32:09 +03:00
Zach Cheung
300209007b add Simplified Chinese translations 2018-10-23 15:38:04 +08:00
Lucas Wiman
45502c0ec2
Put changelog in the right place. 2018-06-30 15:52:00 -07:00
Lucas Wiman
98a1366608 Merge branch 'defer-has-changed' into django-1.11-compatibility 2018-06-21 12:52:33 -07:00
Lucas Wiman
be1a7d9281 Update AUTHORS and CHANGES.
As far as I can tell, no changes to documentation is required.
2018-06-21 12:41:42 -07:00
João Amaro
6d2ba63387 update changelog and versions for 3.1.2 2018-05-09 14:45:37 -03:00
Hanley Hansen
18dfb6b2cf
Merge pull request #279 from hanleyhansen/inheritance-iterable
Update InheritanceIterable to inherit from ModelIterable instead of BaseIterable
2018-05-02 14:14:22 -04:00
Jack Cushman
d34043fd25 Avoid fetching deferred fields in has_changed 2018-02-10 10:53:36 -05:00
Tony Narlock
baa8bae1c0 update changelog and versions for 3.1.1 2017-12-17 07:45:56 -06:00
Tony Narlock
8a0d00b939 tag 3.1.0 2017-12-11 08:27:41 -06:00
Hanley
8c935d3a83 update changes.rst 2017-06-23 09:56:51 -04:00
Carl Meyer
100d2d7a24 Bump version to 3.0.1a1. 2017-04-13 16:51:52 -07:00
Carl Meyer
2e3b50dcb6 Bump version to 3.0.0. 2017-04-13 16:49:58 -07:00
Sachi King
8cb21aabbc Support django 1.11 iterator changes
Django starting with 1.9 switched to using a class to provide an
iterator for the querymanager.  Between 1.9 and 1.10 changes slowly
stopped referencing that function and instead started calling
_iterator_class directly.

As the functionality model-utils is patching has moved, this patch moves
the iterator logic to a class to match the changes that have been made
in Django in version 1.9.

As Django 1.8 is a LTS release that is still supported, iterator()
is retained in the InheritanceQuerySetMixin and can be removed when
support for Django 1.8 is removed.  This goes for the try-except in the
import statements as well.
2017-04-02 21:53:15 +10:00
Bruno Alla
d6edfdb4db Update CHANGES.rst 2017-02-15 23:13:55 +00:00
Ryan P Kilby
fda2d39ec4 Drop unsupported django versions 2017-01-12 12:16:40 -05:00
Carl Meyer
625e1041cc Bump version to 2.6.2.a1. 2017-01-11 16:07:17 -08:00
Carl Meyer
269f6f130f Bump version to 2.6.1. 2017-01-11 15:37:06 -08:00
Carl Meyer
6a01f3389a Add spaces in changelog for consistency with older sections. 2017-01-11 15:35:51 -08:00
Romain G
03fd2fb0a0 Add missing newline 2017-01-11 12:22:59 +00:00
Romain G
7ae505733e Update CHANGES 2017-01-11 12:21:42 +00:00
Bruno Alla
0787a098fd Update changelog about 2 recent pull requests
https://github.com/carljm/django-model-utils/pull/239
https://github.com/carljm/django-model-utils/pull/240
2017-01-09 13:29:07 +00:00
Bruno Alla
abd163f297 Remove extra backtick 2017-01-08 11:18:31 +00:00
Bruno Alla
ecf80381de Reword changes, use GH- convention for tickets and PR 2017-01-07 14:20:00 +00:00
Bruno Alla
336ac14144 Add changes at the top of the Changelog 2017-01-05 18:32:33 +00:00
Carl Meyer
68bc61e825 Update changelog and AUTHORS. 2016-11-21 11:36:25 -08:00
Carl Meyer
e1a3cee4d3 Bump version to 2.6.1.a1. 2016-09-19 08:05:40 -06:00
Carl Meyer
a9a8451fc9 Bump version to 2.6. 2016-09-19 08:03:42 -06:00
Radosław Ganczarek
9e90dde2e8 Add SoftDeletableModel 2016-09-12 15:11:34 +02:00
Alexey Evseev
9ee6065f81 Support Django 1.10 deferred FileField with FieldTracker 2016-09-08 18:00:48 +03:00
Carl Meyer
65b0823e16 Bump version to 2.5.3a1. 2016-08-09 15:09:11 -06:00
Carl Meyer
da8e8cf3c9 Include runtests.py in sdist; bump version to 2.5.2. 2016-08-09 15:06:49 -06:00
Carl Meyer
34e4b6880f Bump version to 2.5.2a1. 2016-08-03 08:44:29 -06:00
Carl Meyer
5904008eab Bump version and update changelog for 2.5.1 release. 2016-08-03 08:38:59 -06:00
Artis Avotins
d1337d5a7c Fixed a bug with Django >= 1.9 where values_list was called on
InheritanceQuerySet with `select_subclasses` applied as strings
raised AttributeError exception.

Adds a new test case `test_dj19_values_list_on_select_subclasses`
2016-05-25 18:58:03 +02:00
Carl Meyer
c5417eb613 Bump version for dev. 2016-04-18 15:08:15 -06:00
Carl Meyer
a43027ccee Bump version to 2.5. 2016-04-18 15:02:40 -06:00
Mike Bryant
ff3f8e5546 Use all the fields to determine _id variants. Fixes #214
If a tracker is defined on an inherited model, where the parent has a ForeignKey,
the tracker will now correctly determine that the field_map takes `fk` -> `fk_id`
2016-03-31 15:45:19 +01:00
Adam Bogdał
fa72fb1521 Update changelog 2016-02-09 00:24:10 +01:00
Carl Meyer
d7e3718964 Add CI on Python 3.5, drop Python 3.2. 2016-02-08 15:45:13 -07:00
Carl Meyer
e070237a34 README and changelog updates. 2015-12-02 12:54:06 -07:00
Carl Meyer
520f1f74d1 Add missed changelog entry for removal of PassThroughManager. 2015-12-02 12:47:07 -07:00
Carl Meyer
f1f8749fa9 Bump version to 2.4.1a1. 2015-12-02 10:55:59 -07:00
Carl Meyer
3c8fe6a7d2 Bump version to 2.4. 2015-12-02 10:43:11 -07:00
Carl Meyer
b06fa8c752 Update AUTHORS and changelog. 2015-10-28 17:16:50 -06:00
Carl Meyer
165e0ec495 Bump version for 2.4 development. 2015-07-20 10:32:18 -06:00
Carl Meyer
443108c7ad Set version for 2.3.1 release. 2015-07-20 10:22:27 -06:00
Carl Meyer
b2149c8e73 Remove translations automation in setup.py. Fixes GH-178, GH-179. 2015-07-20 09:56:07 -06:00
Carl Meyer
ab4a2b4ce4 Bump version to 2.4a1. 2015-07-17 13:02:07 -06:00
Carl Meyer
b1c183d475 Bump version to 2.3. 2015-07-17 11:38:39 -06:00
Carl Meyer
b09fa1e14e Add changelog note about Django 1.8 compat. 2015-07-17 11:37:59 -06:00
Philipp Steinhardt
8bd2f8bcda * update AUTHORS.rst and CHANGES.rst 2015-07-02 14:30:09 +02:00
Carl Meyer
b54d4652a3 Update AUTHORS/changelog. 2014-10-29 16:20:02 -06:00
Carl Meyer
67ec6e4b53 Update changelog. 2014-09-22 12:12:39 -06:00
bboogaard
31170692a5 Update CHANGES.rst 2014-09-01 09:30:29 +02:00
bboogaard
ac0957e3ec Update AUTHORS.rst and CHANGES.rst 2014-08-19 10:42:41 +02:00
Carl Meyer
54d915bd4a Bump version to 2.3a1. 2014-07-31 18:57:29 -06:00
Carl Meyer
c62fe9446d Add Changelog entry for revert of GH-130; bump version to 2.2. 2014-07-31 18:16:15 -06:00
Carl Meyer
2b1c7e3757 Merge branch '2.1.x'
* 2.1.x:
  Bump version to 2.1.2a1.
  Bump version to 2.1.1.
  ASCII-fold changelog, again. Fixes GH-141.
  Bump version to 2.1.1a.

Conflicts:
	CHANGES.rst
	model_utils/__init__.py
2014-07-28 10:03:53 -06:00
Carl Meyer
19c9c380df Bump version to 2.1.2a1. 2014-07-28 10:02:39 -06:00
Carl Meyer
bd3787a4a8 Bump version to 2.1.1. 2014-07-28 10:00:40 -06:00
Carl Meyer
abd47ed406 ASCII-fold changelog, again. Fixes GH-141. 2014-07-28 09:59:29 -06:00
Carl Meyer
4ed7eb05e5 Bump version to 2.1.1a. 2014-07-28 09:59:23 -06:00
Carl Meyer
6def1b416f ASCII-fold changelog, again. Fixes GH-141. 2014-07-28 09:55:18 -06:00