Commit graph

321 commits

Author SHA1 Message Date
Lucas Wiman
ca2fbb4ccd Fix coverage for a codepath only executed in <1.10 environments. 2018-06-28 16:59:30 -07:00
Lucas Wiman
59347ef36f Correctly clean up recursion sentinel value. 2018-06-28 13:52:52 -07:00
Lucas Wiman
15f9393bb2 Handle API change in DeferredAttribute descriptor in django-trunk.
This should maintain compatibility with the next version of django.
2018-06-28 13:16:33 -07:00
Lucas Wiman
a84c3afddd Fix behavior of .previous() in Django 1.10+.
The complications are that when the attribute is set in Django 1.10,
it no longer counts as a deferred attribute, and it is not retrieved from the database.
Naively updating __set__ to retrieve the value if it is deferred leads to infinite
recursion because accessing the attribute involves loading data from the database
and trying to set the attribute based on that value. This commit introduces
a somewhat hacky flag that records whether we're already trying to set
the attribute further up in the call stack.
2018-06-28 13:15:56 -07:00
Lucas Wiman
5d410e9ccc Fix test failures from merge. 2018-06-28 11:29:44 -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
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
Lucas Wiman
0fc0b44c95 Remove version checks for django<1.8.
Support for older versions of django was dropped in 3.0.0.
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
Tony Narlock
c4d72123ef rm use_for_related_fields #290 2017-12-07 12:20:50 -06:00
Tony Narlock
a07140e771 Use _chain for django 2.0, #295 2017-12-07 11:13:39 -06:00
Hanley
0a809df4da make InheritanceIterable inherit from ModelIterable instead of BaseIterable 2017-06-23 09:51:32 -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
10ebc16271 Exclude tests from distribution
fixes #258
2017-02-15 23:00:10 +00:00
Romain G
d07b992b94 Drop old get_query_set syntax, replaced by get_queryset now 2017-01-12 18:34:47 +00:00
Ryan P Kilby
e148c670d1 Fix django 2.0 warnings 2017-01-12 12:16:46 -05: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
Romain G
63e5c59c66 Simplify test models + make it compatible for old Django versions 2017-01-09 19:16:09 +00:00
Romain G
679af01f26 Add fix + tests for abstract manager inheritance issue with StatusModel 2017-01-09 19:02:59 +00:00
Bruno Alla
2af54972eb Revert unrelated change regarding related fields
Remove attribute use_for_related_fields in SoftDeletableManagerMixin.
2017-01-05 18:32:13 +00:00
Bruno Alla
063332643d Split SoftDeletableQuerySet/Manager into Mixin 2017-01-05 14:40:03 +00:00
Bruno Alla
0efaad1218 Fix issue when extend QuerySet and Manager - fixes #249 2017-01-05 14:29:35 +00:00
Bruno Alla
4311e24e98 Add soft parameter to delete method instead of new one 2016-11-28 23:45:48 +00:00
Bruno Alla
6efab67b79 Merge remote-tracking branch 'carljm/master' into feature/soft-delete-purge
# Conflicts:
#	model_utils/tests/tests.py
2016-11-28 23:31:16 +00:00
romgar
eb41dc0ea0 Prevent test manual import for Django 1.6+. No impact on Django 1.7/1.8, duplicating all test runs in Django 1.6 2016-11-24 21:31:55 +00:00
romgar
2a9c199819 Remove test duplication related to TestCase inheritance in different files 2016-11-24 21:31:23 +00:00
romgar
6fefc53c58 Separate tests in small files, making it easier to edit/add new ones/not conflict on different merge requests 2016-11-23 23:49:53 +00:00
Carl Meyer
94870b2510 Merge pull request #242 from romgar/ticket_241_double_monitor_field_recursion_error
Tests to demonstrate recursion error with double MonitorField and defer()/only() usage
2016-11-21 11:13:31 -08:00
romgar
8ecf75144b Update tests to use freezegun to avoid time resolution issues on Windows 2016-11-20 22:08:07 +00:00
romgar
e2440a6872 Add tests to prevent regression in MonitorField behaviour if we filter out deferred fields in _save_initial 2016-11-19 12:08:48 +00:00
romgar
93dd940a5d Remove defered fields in _save_initial only for Django 1.10+ 2016-11-18 23:31:45 +00:00
romgar
2455c983fc Restore initial indentation 2016-11-18 23:12:39 +00:00
romgar
72158f1820 Avoid to directly initialise a monitored field if defered to avoid recursion issue 2016-11-18 23:11:23 +00:00
romgar
e9d57e60fe Add test to demonstrate issue #241 2016-11-18 00:24:57 +00:00
Bruno Alla
ff4afd7288 Add a purge_from_db to SoftDeletableModel 2016-11-17 08:56:59 +00:00
Bruno Alla
516c457747 SoftDeletableModel: use correct DB connection
When deleting a SoftDeletableModel instance, the `using` parameter
should be passed down to the `save()` method.

https://docs.djangoproject.com/en/1.10/topics/db/multi-db/#selecting-a-d
atabase-for-save
2016-11-09 19:49:31 +00: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