Commit Graph

80 Commits (a16345874e14eddccf406c73ef4784c2b9eeff39)

Author SHA1 Message Date
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
Andrew Dodd 120f124b91 Issue #200 - Exclude super-class from proxy model query sets
These changes prevent the query sets on 'proxy' models from including
the items from the 'super-class'.
2016-05-04 15:52:44 +02:00
NotSqrt b8c8ff7bfa Test that expressions are supported 2016-04-26 20:12:04 +02: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
Frankie Dintino 6df1403de5 Add support for qset.only() and qset.defer() 2016-01-04 00:36:48 -05:00
gilgamezh b17aa58ad9 Merge remote-tracking branch 'upstream/master' into allow_extra_manager 2015-12-29 17:49:09 -03:00
Diederik van der Boor b0657ef9c7 Fix reverse relation support for ___ filter operator 2015-12-29 14:52:58 +01: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 5191b6c130 Also remove showfields imports from __init__.py
If we're to cause pain, let it be once.
2015-12-28 17:10:42 +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 07242d210f Fix "Model" __ "_field" query support
Broken by 24e6b21204 for Django 1.9
upgrade
2015-12-28 16:19:27 +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
gilgamezh f419e37ab3 Allow to set a 'extra' custom manager withut override the _default_manager 2015-12-23 21:07:44 -03:00
Jonas Haag 24e6b21204 Fix a handful of warnings and remove some unused compatibility code 2015-12-16 10:31:36 -03:00
Hugo Osvaldo Barrera adcad20b48 Update all tests (and runtests.py) 2015-12-16 10:31:36 -03:00
Diederik van der Boor c8973d1fba Fixed Python 2.6 tests, and fixed tox.ini from PR #162 for python 3 2015-10-01 14:35:34 +02:00
Diederik van der Boor 2ffbd51844 Added as_manager() support for querysets 2015-10-01 14:26:28 +02:00
Diederik van der Boor 17c2445e39 Merge pull request #120 from theatlantic-pr/cleanup-test-noise
Conflicts:
	polymorphic/tests.py
2015-04-08 13:33:54 +02:00
Diederik van der Boor c947c3dec1 Merge pull request #119 from theatlantic/child-model-custom-pk-bug
Bug with queryset results on base model where child model has a custom primary key
2015-04-08 13:09:35 +02:00
Frankie Dintino ad63c6a442 Test missing items bug in qset on child of PolymorphicModel w custom pk
refs #66
2015-01-31 17:10:57 -05:00
Frankie Dintino fd24863db5 Cleanup tests by removing spurious errors and unnecessary noise
- Remove diamond inheritance tests since these test a bug in Django,
  not in django_polymorphic.
- Fix spurious print message in test_primary_key_custom_field_problem(),
  where uuid instances are for some reason being compared to uuid.UUID
  classes. Replaced with a test that checks that the primary key values
  are valid UUIDs.
- Remove Django > 1.6 conditionals wrapping the multiple inheritance
  tests and model definitions, in favor of using the definitions for
  Django 1.7. Django 1.7 requires a custom primary key when using concrete
  model inheritance because failing to do so is potentially ambiguous. Adding
  the custom primary key does not break tests in older Django versions.
2015-01-31 16:59:55 -05:00
Chris Barna d56d9bfd15 Add tests for instance._default manager. Refs #96 2015-01-31 13:17:56 -05:00
Diederik van der Boor ca6fba91ba PEP8-ify PR #67 and fix trailing whitespace
Camp rule: leave things in a better state then you found it.
2014-12-30 13:36:25 +01:00
Diederik van der Boor 261e382556 Merge pull request #67 from hottwaj/parent_link_support
parent_link and related_name support for inheritance fields
2014-12-30 13:34:16 +01:00
Diederik van der Boor 948749dbdb Remove Django 1.7 warnings 2014-10-14 17:30:25 +02:00
Diederik van der Boor 981614e5c6 Merge branch 'django_1.7_support' of https://github.com/g3rd/django_polymorphic
Conflicts:
	docs/managers.rst
	polymorphic/admin.py
	polymorphic/manager.py
	polymorphic/tests.py
	runtests.py
2014-09-22 15:42:35 +02:00
Diederik van der Boor cf6d2a4a41 Replace get_query_set with assignment.
Avoid calling the super class by accident, potentially causing loops.
Follow the django-mptt approach here.
2014-09-22 15:00:29 +02:00
Chad Shryock 734752c2e7 Django 1.7 upgrades 2014-09-16 22:11:13 -04:00
Marius Lueck fb1795ad12 Fixed compatibility with django 1.8 2014-07-25 11:48:07 +02:00
Diederik van der Boor b9d7e9f234 Improved description of test_proxy_get_real_instance_class unit test
Camp life rule: leave things better then you found them.
2014-04-29 14:07:33 +02:00
John Furr 8687e135a3 Test that proxy models derived from PolyMorphicBase classes
can call get_real_instance() and get_real_instance_class()

Includes:
def test_proxy_get_real_instance_class(self):
2014-04-29 07:35:27 -04:00
hottwaj fd0ed96c1a Fixed bugs in superclass/subclass field link processingso that this can cope with proxy models, as well as parent_link and related_name links to parents.
Added a test case for testing parent_link and related_name links to parent.

All tests pass should pass now (at least they do for me on django 1.5 and python 2.7)
2014-02-19 10:56:02 +00:00
Gavin Wahl 7f2111c201 assertQuerysetEquals requires an ordered queryset 2013-05-24 15:17:44 -06:00
Diederik van der Boor 4d7d33ed0d Port new code to Python 3 as well, fix six.with_metaclass() issues
Many thanks to @atheiste for the big porting steps!
2013-05-20 16:03:21 +02:00
Diederik van der Boor c933be9c24 Port documentation to Sphinx, cleanup README 2013-05-19 17:15:41 +02:00
floppya 54cf2f37d8 Updated proxy model tests
Extracted classes from original proxy test.
Added another simple proxy model test.
Moved the test case to a seemingly better spot.
2013-04-08 00:32:06 +02:00
floppya 74389bb23d Update for proxy models and Django 1.5
Only monkeypatch when using Django < 1.5
Updated test
2013-04-08 00:05:21 +02:00
Jedediah Smith e2cfbf3898 Support proxy models (still requires one query per proxied model, not optimal) 2013-04-07 23:36:09 +02:00
Diederik van der Boor 78253bfe12 Fix passing custom querysets to related managers.
* The custom manager was not assigned to _default_manager;
  get_first_user_defined_manager() always returned None
* The PolymorphicManager couldn't remember it's custom queryset;
  a RelatedManager creates a new instance of a manager, so the queryset
  parameter should be known at class-level, not object level.
* The old method of providing a custom queryset class has been deprecated.
2013-04-07 01:39:58 +02:00
Diederik van der Boor ca4067e279 Add proxy model test that fails in Django 1.5 2013-04-05 17:36:50 +02:00
Diederik van der Boor e411660b80 Tests: fix missed error in last commit
(cannot amend, already pushed for review)
2013-04-05 12:01:44 +02:00
Diederik van der Boor ebced5f4eb Tests: make old code more readable 2013-04-05 11:45:07 +02:00
Diederik van der Boor 7ca328f9e4 Tests: auto removed unused imports 2013-04-05 11:39:57 +02:00
Diederik van der Boor 2d83124f51 Tests: remove Django 1.1 compatibility check 2013-04-05 11:38:56 +02:00
Diederik van der Boor 25aa32d7bd Replaced the doctests with unit tests
Making debugging tests much easier. The same repr() logic is preserved,
so this is essentually a huge coding style change.
2013-04-05 11:33:41 +02:00
Diederik van der Boor 32426aa41a Use self.assertEqual() in tests instead of assert statement. 2013-04-05 09:54:48 +02:00