[Python-modules-commits] [django-polymorphic] 03/15: Import django-polymorphic_1.0.1.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Sun Sep 18 16:24:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository django-polymorphic.
commit ad969467f02701e13bdb4ad359c84cfcf72b621e
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Mon Sep 12 08:30:34 2016 +0200
Import django-polymorphic_1.0.1.orig.tar.gz
---
docs/changelog.rst | 6 ++++++
polymorphic/__init__.py | 2 +-
polymorphic/base.py | 5 ++++-
polymorphic/tests.py | 13 +++++++++----
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 9d74887..e3d38a3 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,12 @@
Changelog
=========
+Version 1.0.1 (2016-09-11)
+--------------------------
+
+* Fixed compatibility with manager changes in Django 1.10.1
+
+
Version 1.0 (2016-09-02)
------------------------
diff --git a/polymorphic/__init__.py b/polymorphic/__init__.py
index db6539c..1e85e95 100644
--- a/polymorphic/__init__.py
+++ b/polymorphic/__init__.py
@@ -7,7 +7,7 @@ This code and affiliated files are (C) by Bert Constantin and individual contrib
Please see LICENSE and AUTHORS for more information.
"""
# See PEP 440 (https://www.python.org/dev/peps/pep-0440/)
-__version__ = "1.0"
+__version__ = "1.0.1"
# Monkey-patch Django < 1.5 to allow ContentTypes for proxy models.
diff --git a/polymorphic/base.py b/polymorphic/base.py
index 1c472b6..3405ba5 100644
--- a/polymorphic/base.py
+++ b/polymorphic/base.py
@@ -92,7 +92,10 @@ class PolymorphicModelBase(ModelBase):
new_class._default_manager._inherited = False # the default mgr was defined by the user, not inherited
# validate resulting default manager
- self.validate_model_manager(new_class._default_manager, model_name, '_default_manager')
+ if django.VERSION >= (1, 10) and not new_class._meta.abstract:
+ self.validate_model_manager(new_class.objects, model_name, 'objects')
+ else:
+ self.validate_model_manager(new_class._default_manager, model_name, '_default_manager')
# for __init__ function of this class (monkeypatching inheritance accessors)
new_class.polymorphic_super_sub_accessors_replaced = False
diff --git a/polymorphic/tests.py b/polymorphic/tests.py
index 379e955..d048313 100644
--- a/polymorphic/tests.py
+++ b/polymorphic/tests.py
@@ -990,11 +990,16 @@ class PolymorphicTests(TestCase):
# by choice of MRO, should be MyManager from MROBase1.
self.assertIs(type(MRODerived.objects), MyManager)
- # check for correct default manager
- self.assertIs(type(MROBase1._default_manager), MyManager)
+ if django.VERSION < (1, 10, 1):
+ # The change for https://code.djangoproject.com/ticket/27073
+ # in https://github.com/django/django/commit/d4eefc7e2af0d93283ed1c03e0af0a482982b6f0
+ # removes the assignment to _default_manager
- # Django vanilla inheritance does not inherit MyManager as _default_manager here
- self.assertIs(type(MROBase2._default_manager), MyManager)
+ # check for correct default manager
+ self.assertIs(type(MROBase1._default_manager), MyManager)
+
+ # Django vanilla inheritance does not inherit MyManager as _default_manager here
+ self.assertIs(type(MROBase2._default_manager), MyManager)
def test_queryset_assignment(self):
# This is just a consistency check for now, testing standard Django behavior.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-polymorphic.git
More information about the Python-modules-commits
mailing list