Commit Graph

81 Commits (8fb8f47fb074b54a50a48c4ebb145a1c262be7b3)

Author SHA1 Message Date
Diederik van der Boor 8fb8f47fb0
Fix compatibility with Django 3.0 alpha
Removed django.utils.six dependency, copied the parts we still need for
Python 2 compatibility.
2019-07-12 17:39:59 +02:00
Diederik van der Boor f769ed7568
Fix dealing with missing derived table data with new prefetching code 2019-07-12 10:01:40 +02:00
Diederik van der Boor 3d9587acfb
Merge PR #353 2019-07-12 09:45:21 +02:00
Diederik van der Boor f9492a12a8
Merge pull request #371 from tumb1er/replace_iterable_class
replace iterable class in qs.non_polymorphic
2019-07-11 22:03:07 +02:00
gtors f06a02a3d0 Issue #373 : Fix bug with get_real_instances on empty base_result_objects 2019-07-11 21:59:46 +02:00
tumb1er c565ae101a replace iterable class in qs.non_polymorphic 2018-11-28 17:23:00 +03:00
Markus Grimm 6040e9891a Fix prefetch_related behavior 2018-06-28 15:10:43 +02:00
Diederik van der Boor a6aa95c07e Fixed internal usage of deprecated `base_objects`
Reverted the change in f898f80594 that
also replaces the internal `base_objects` with `.non_polymorphic()`.
That also changed which querysets was used. Use a clean queryset
instead that has no select-related/prefetch information, etc.. like
previous versions did.
2018-02-05 13:00:23 +01:00
Diederik van der Boor f898f80594 Fixed unwanted manager replacement in Django 1.11 projects.
Django 1.11 uses the old manager inheritance system, unless it's
overwritten with manager_inheritance_from_future. With a class layout
like:

  PolymorphicModel  (abstract)
    PolymorphicMPTTModel  (abstract)
      GenericCustomer  (concrete, has objects = ...)
        CustomerGroupBase (abstract, has objects = ...)
          Partner (concrete, no manager)
            BranchPartner  (concrete, no manager)

The last level gets a normal Django Manager instead of the polymorphic
manager. Because the PolymorphicModel had a base_objects manager, this
was typically used as _default_manager. Now that the default manager is
no longer affected, it's also easier to detect why the "objects" doesn't
get the proper manager type. Using "manager_inheritance_from_future" is
recommended instead to have both the right behavior and forward
Django 2.x compatibility.
2018-02-04 13:22:51 +01:00
Diederik van der Boor f7c9df935f move _polymorphic_iterator to PolymorphicModelIterable as there is no second compatibility code path anymore 2018-01-22 15:22:27 +01:00
Krzysztof Gromadzki 010a23425f Add support for bulk_create 2017-12-29 19:05:57 +01:00
Diederik van der Boor 30630647c4 Add extra comment why deferred fields are skipped with ___ lookups 2017-09-30 20:26:52 +02:00
trbs 9500a21f82 fix error with .defer and child models that use the same parent
When using .defer on a PolymorphicQuerySet with multiple childs that
subclass from the same polymorphic parent model yield an error like:

>>> Base.objects.defer('ModelY___field_y')
Traceback (most recent call last):
...
FieldDoesNotExist: ModelX has no field named 'field_y'
2017-08-30 21:17:05 +02:00
Jerome Leclanche 0c7b1aa657 Drop support for Django 1.8 2017-08-29 19:41:42 +03:00
Jerome Leclanche 87979a6660 Remove outdated 404 url from docstrings 2017-07-10 09:08:11 +03:00
Jerome Leclanche 298460c4cf Drop support for Django <1.8, Python <2.7 2017-07-10 09:08:11 +03:00
Diederik van der Boor bcb8b0d3a4 Allow .order_by() to pass expressions unchanged
Fixes: #257
2017-05-22 12:53:20 +02:00
Charlie Denton 6f733d7471
Fix minor typo 2017-05-07 22:19:50 +01:00
Diederik van der Boor 61b398115b Fixed queryset processing for real (another merge fix for pr #279) 2017-04-26 16:44:54 +02:00
Diederik van der Boor 09d785f5bb Fix infinite recursion on github editing of pr #279
Fixes: 89632483a7
2017-04-26 16:38:26 +02:00
Diederik van der Boor 89632483a7 Merge branch 'master' into dj111-fix 2017-04-26 15:53:59 +02:00
un.def 78d3cd4945 Fix regression with Django < 1.9 2017-04-19 14:43:51 +03:00
un.def dbad7bd40d Migrate from unused in Django 1.11 qs.iterator() to custom qs._iterable_class 2017-04-19 12:56:04 +03:00
Charlie Denton f010c6ddf7
Get tests running on django 1.11
I'm a little concerned that this loses some of the efficiencies (in
particular, chunking) from previous versions. That's something that can
probably be improved.
2017-04-12 23:52:06 +01:00
Diederik van der Boor f9fffc44c1 Add API documentation to the package! 2017-01-09 16:53:50 +01:00
Diederik van der Boor 4aa3355f5c flake8 fixes 2016-12-19 11:28:41 +01:00
Diederik van der Boor 1d13b4f3c5 autopep8, except line length 2016-12-19 11:10:03 +01:00
Austin Matsick f1735a8bea #220 Pass hints to returned queryset in PolymorphicManager.get_queryset. 2016-06-12 22:15:37 -05:00
Alex Alvarez a16345874e Issue #213: Don't modify Q passed in as arguments 2016-06-02 01:10:43 -04:00
Austin Matsick 4aece2b5d3 #216 Use self._state.db instead of `using` kwarg in model methods.
Thanks to @vdboor for the suggestion.

Also:
- Add missing `using` kwargs in query_translate functions.
- Add a couple unit tests for non-default database functionality.
2016-05-30 18:55:03 -05:00
Austin Matsick 2f11cb6ffd #216 Specify `using` kwarg in get_real_instance method calls. 2016-05-29 14:05:45 -05:00
Austin Matsick 343aa41ec1 #216 Allow ContentType queries to be performed on non-default databases. 2016-05-27 20:35:39 -05:00
Diederik van der Boor 5aa15b226e Improve code flow for Django 1.7/1.8 in patch_lookup args 2016-03-11 17:16:05 +01:00
Diederik van der Boor 88922d7d5e Fix error when using `date_hierarchy` field in the admin
Closes: #201
2016-03-11 17:13:09 +01:00
Diederik van der Boor 6319dabcef Fix trailing whitespace in query.py 2016-03-11 17:13:01 +01:00
Diederik van der Boor 88bb23b506 Fix deferred loading of 'pk' field 2016-02-18 13:14:49 +01:00
Diederik van der Boor 4277c148aa Merge pull request #161 from theatlantic/pr-add-deferred-fields
Add support for qset.only() and qset.defer()
2016-02-17 11:14:48 +01:00
slide333333 9b7c2d72b7 Added test cases for complex expressions in aggregate/annotate 2016-01-21 15:32:28 +01:00
slide333333 c5d4687bb9 Support Django 1.8 complex expressions on aggregate/annotate 2016-01-21 13:21:21 +01:00
Frankie Dintino 6df1403de5 Add support for qset.only() and qset.defer() 2016-01-04 00:36:48 -05:00
Diederik van der Boor 009069a32b Avoid auto-proxying all methods to the queryset.
This is unwanted behavior, and django provides much better methods for
it instead. (PolymorphicQuerySet.as_manager() / PolymorphicManager.from_queryset()
2015-12-28 17:10:58 +01:00
Diederik van der Boor 50f21dfa43 Rename manager.py => managers.py for consistency 2015-12-28 17:10:42 +01:00
Diederik van der Boor b7431b2d06 Fix PEP8 block comment issues (E265) 2015-12-28 15:16:42 +01:00
Diederik van der Boor aaf06c71a5 Fix PEP8 whitespace issues
autopep8 -r polymorphic/ example/ -i
--select=E112,E113,E115,E116,E122,E123,E125,E127,E128,E201,E202,E203,E211,E225,E226,E227,E228,E231,E251,E261,E262,E271,E272,E273,E274,E301,E302,E303,E304,E309,E711,E713,W291,W293,W391
--exclude migrations,south_migrations

(line conditiation fixes: E123,E125,E122,E127,E128)
2015-12-28 15:16:29 +01:00
Jonas Haag 4da67a0fb6 Fix an issue with '.values()' queries 2015-12-16 10:31:36 -03:00
Jonas Haag 0b87a5ecc8 Fixed a Python >= 3.7 incompatibility (see PEP 479) 2015-12-16 10:31:36 -03:00
Jonas Haag 6cf187b2de Fix Django < 1.8 compatibility 2015-12-16 10:31:36 -03:00
Jonas Haag 24e6b21204 Fix a handful of warnings and remove some unused compatibility code 2015-12-16 10:31:36 -03:00
Diederik van der Boor 2ffbd51844 Added as_manager() support for querysets 2015-10-01 14:26:28 +02:00
Sander van Leeuwen ed55ceb7fa Fix Pickle exception when polymorphic model is cached
fixes issue #155
2015-09-04 16:51:22 +02:00