Commit Graph

67 Commits (50f21dfa43ade10d7029761d659cd4f32ee806dc)

Author SHA1 Message Date
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
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
Chris Glass 30172d3110 Merge pull request #24 from onepercentclub/port-regression-doctest-to-unit-test
Port regression doctest to unit test
2013-03-25 02:04:07 -07:00
Ben Konrath 8e4697c741 Port regression doctest to unit test. 2013-03-18 22:33:55 +01:00
Ben Konrath dc6f41c7e9 Update URLs to github hosted webpage. 2013-03-18 21:27:23 +01:00
Ben Konrath 318dd3d67a Fixed the default manager test failures.
According to the django docs (1.4 / 1.5), the default manager for subclasses of
PolymorphicModel should be PolymorphicManager:

3. The default manager on a class is either the first manager declared on the
   class, if that exists, or the default manager of the first abstract base
   class in the parent hierarchy, if that exists. If no default manager is
   explicitly declared, Django’s normal default manager is used.

https://docs.djangoproject.com/en/1.4/topics/db/managers/#custom-managers-and-model-inheritance
https://docs.djangoproject.com/en/1.5/topics/db/managers/#custom-managers-and-model-inheritance
2013-03-18 20:56:12 +01:00
Ben Konrath 1ef9e068df Import settings in tests from django.conf. 2013-03-18 20:47:56 +01:00
Bert Constantin 2c47db8fcc Fixed github issue 15 (query result incomplete with inheritance). Thanks to John Debs. 2011-01-24 17:03:23 +01:00
Bert Constantin 4a4cfd82a2 translate_polymorphic_Q_object: fixed test case, and made the function a member of PolymorphicObject.
Minor test fixes: warnings fixed, test_tool.py renamed as it's no test
2010-11-12 07:19:23 +01:00
Bert Constantin f78b27dc1a updated docs, tests, misc 2010-11-02 12:21:46 +01:00
Bert Constantin 52f32c1fc3 improved showfields.py for better and more precise output, updated tests 2010-11-02 12:21:46 +01:00
Bert Constantin a4ac6cc91d fix object retrieval problem occuring with some custom primary key fields
+ added UUIDField as test case
2010-11-02 12:21:22 +01:00
Bert Constantin 6befe6c733 added "queryset.get_real_instances()" usage, added testcase 2010-11-02 12:10:02 +01:00
Bert Constantin 8c3df56cb6 non_polymorphic() queryset member function added 2010-10-23 12:22:13 +02:00
Bert Constantin 19adbdaf2c extra(): Re-implemented. Now is polymorphic (nearly) without restrictions.
Added test cases + docs.
2010-10-23 11:52:04 +02:00