Commit Graph

43 Commits (ef1feab7094ec061ef75fecec78dd18438542b57)

Author SHA1 Message Date
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
Bert Constantin 6c8d28cbbc extra(): throw error if unsupported argument is encountered, support 'params' argument, special case Django 1.1 2010-10-22 13:37:26 +02:00
Abel Daniel 486a579ac7 Make .extra() only disable polymorphic query if an arg that is currently
not handled is actually used. I.e. if all args are supported, then
do polymorphic query by default.
2010-10-22 13:35:50 +02:00
Bert Constantin b2357592cb make sure 'base_manager is not inherited (but managed by Django instead).
(This seems more correct but it doen't seem to make any difference.)
Also added related test cases.
2010-10-22 13:35:39 +02:00
Bert Constantin 6628145af7 removed __getattribute__ hack from PolymorphicModel.
A somewhat cleaner solution is now used (through __init__) which
also completely removes the performance impact of __getattribute__.
2010-10-20 09:31:42 +02:00
Bert Constantin b1905026bc Documentation updated.
Test_all_versions script added.
Some minor misc changes.
Added polybench.
2010-10-20 09:31:36 +02:00
Bert Constantin c10ff1650b added translate_polymorphic_Q_object 2010-10-19 21:28:33 +02:00
Bert Constantin 01bdb2f9b0 - renamed ShowField* to ShowFieldType, ShowFieldContent, ShowFieldTypeAndContent, in order to reflect better what they do.
- by default, django_polymorphic's pretty printing of querysets/objects (via ShowField*) is not used anymore
- ShowField mixins now also show the annotations (after the regular fields, prepended by "Ann:")
- cleaned up implementation.
2010-10-19 21:28:33 +02:00
Bert Constantin 116e2af08b IMPORTANT: import path changed, it's now: "from polymorphic import PolymorphicModel, ..."
- added python2.4 compatibility. Contributed by Charles Leifer. Thanks!
- general reorganization of the code - there is no single polymorphic.py module anymore,
  so d-p now needs to be installed as a regular Django app
- polymorphic.VERSION/get_version added
- version numbering started: V0.5 beta
2010-02-22 16:16:00 +01:00
Bert Constantin e6c1e7ec6e fix "...has no attribute 'sub_and_superclass_dict'". Thanks to Mattias Brändström.
this occurred if a subclass defined __init__ and accessed class
members before calling the superclass __init__
(__getattribute__ had a problem, as "sub_and_superclass_dict" was set in __init__).
2010-02-18 20:18:49 +01:00
Bert Constantin 7e584632b8 fix unnecessary field-name/model-name conflicts (i.e. field_name == model_name.lower() )
=> __init__ + __getattribute__ now handle only the Django inheritance
references that are needed ('modela_ptr', 'modelc' etc.), avoiding
unnecessary conflicts with field names.
2010-02-18 20:05:17 +01:00
Bert Constantin 2795f7acd5 some doc + minor code updates (__repr__ + Show... mixins) 2010-02-18 20:04:38 +01:00
Bert Constantin 2fcb7fba1a queryset order_by method added, testcase, docs 2010-02-04 16:38:58 +01:00
Bert Constantin c10577c32f queryset aggregate() and extra() methods implemented, testcases, docs 2010-02-04 15:28:55 +01:00
Bert Constantin 9e7a78a8cb queryset annotate() method implemented, and testcase 2010-02-04 15:28:55 +01:00
Bert Constantin 2a740e9b10 doc- and minor code updates 2010-02-04 15:13:33 +01:00
Bert Constantin c7ac78e08d Fixed ContentType related field accessor clash (an error emitted by model validation),
by adding related_name to the ContentType ForeignKey. Thanks to  Andrew Ingram.
This happened if a polymorphc model used a ContentType ForeignKey.
Plus minor documentation updates.
2010-01-30 14:15:52 +01:00
Bert Constantin 8bdda93e76 Restructured django_polymorphic into a regular add-on application.
This is needed for the management commands, and also seems
to be a generally good idea for future viablity as well.
Also misc documentation updates.
2010-01-29 13:41:19 +01:00