Commit Graph

28 Commits (56444b0f65bf5770cfe4ee8e5f7bdf6288ff635b)

Author SHA1 Message Date
Diederik van der Boor e76259fa2e Fix dumpdata hack on Windows 2016-09-12 10:35:47 +02:00
Diederik van der Boor c97d1ef088 Let tests pass on Django 1.10.1
The change for https://code.djangoproject.com/ticket/27073
in d4eefc7e2a
removed the _default_manager assignment
2016-09-11 21:32:19 +02:00
Diederik van der Boor a5e348ffb9 Disable the old _default_manager and _copy_to_model() fiddling.
This no longer works on Django 1.10, which has a new way to find the
default manager
2016-08-05 17:21:18 +02: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 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
gilgamezh f419e37ab3 Allow to set a 'extra' custom manager withut override the _default_manager 2015-12-23 21:07:44 -03:00
Diederik van der Boor d85664f0b7 Optimize PolymorphicModel attribute access, only use __getattribute__ hack when needed. 2015-10-01 14:03:33 +02:00
Frankie Dintino a3d9379876 Set _default_manager directly on model_cls; don't use add_to_class()
Using model_cls.add_to_class() calls Manager.contribute_to_class(),
which then sets the attribute to an instance of ManagerDescriptor. In
the case of _default_manager, this behavior differs from Django's, as
_default_manager is set to the manager instance itself, not its
descriptor. This is why it is normally possible to access default_manager
from a model instance.

fixes #96
2015-01-31 13:17:56 -05:00
Diederik van der Boor 4bddac7c70 Fix validate_model_fields(), caused errors when metaclass raises errors 2014-10-29 18:58:54 +01:00
Diederik van der Boor 4be6d42fad Optimize NewBase test of six.with_metaclass() for Django 1.5+ 2014-02-13 10:43:33 +01: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
Tomas Peterka cbf52a61af Porting to Python 3.2
Removed compatibility_tools (because we aim to Python 2.7 and Python 3.2)
Performed 2to3 and modified
Usage of django.utils.six which adds dependency on Django >= 1.4.2
2013-05-20 16:03:21 +02:00
Diederik van der Boor 19d5ed2338 Fix base_manager unit test
As more methods are added to the PolymorphicModel, the attr dict changes
ordering in the meta class. By making the ordering of managers
consistent, this problem no longer occurs.
2013-04-08 00:32:02 +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 1f26302632 Fix Django 1.5 support, tests pass again.
The reason polymorphic broke was because it couldn't find some managers
anymore in the inheritance tree. Django 1.5 removes these and replaces
them with an `AbstractManagerDescriptor`. This patch restores those objects
2013-04-07 00:43:41 +02:00
Ben Konrath dc6f41c7e9 Update URLs to github hosted webpage. 2013-03-18 21:27:23 +01:00
German M. Bravo f987818fe4 PEP 8 cleaning
Conflicts:

	polymorphic/__init__.py
	polymorphic/polymorphic_model.py
2011-12-20 18:59:50 +00:00
German M. Bravo c9922d8987 PEP 8 cleaning 2011-12-20 18:59:50 +00:00
Martin Brochhaus dfc8eff1e1 Not using attrs when getting the first user defined manager. 2011-12-09 15:22:38 +08:00
Jonas Obrist fabae70ed4 protip: after a colon in python, HIT THE ENTER KEY! 2011-05-19 06:02:53 -07: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 3cc7d483c1 minor additions in base.py 2011-01-24 16:45:58 +01: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 a87481b8b5 polymorphic_dumpdata management command functionality removed;
the regular Django dumpdata command now automatically works correctly
for polymorphic models and all Django versions
(this is handled by PolymorphicModelBase now).
Testing for dumpdata has been added.
2010-10-20 09:31:42 +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