Replace use_for_related_fields by Meta.base_manager_name

Deprecated in 1.10, removed in 2.0

More information:
- https://code.djangoproject.com/ticket/14891
- django/django@ed0ff913c6
fix_request_path_info
Jerome Leclanche 2017-05-19 10:14:18 +03:00
parent 6fe1e2ddae
commit fc8cabfa26
2 changed files with 4 additions and 5 deletions

View File

@ -23,8 +23,6 @@ class PolymorphicManager(models.Manager):
Usually not explicitly needed, except if a custom manager or
a custom queryset class is to be used.
"""
# Tell Django that related fields also need to use this manager:
use_for_related_fields = True
queryset_class = PolymorphicQuerySet
@classmethod

View File

@ -40,9 +40,6 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
# for PolymorphicQuery, True => an overloaded __repr__ with nicer multi-line output is used by PolymorphicQuery
polymorphic_query_multiline_output = False
class Meta:
abstract = True
# avoid ContentType related field accessor clash (an error emitted by model validation)
#: The model field that stores the :class:`~django.contrib.contenttypes.models.ContentType` reference to the actual class.
polymorphic_ctype = models.ForeignKey(
@ -58,6 +55,10 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
objects = PolymorphicManager()
base_objects = models.Manager()
class Meta:
abstract = True
base_manager_name = "objects"
@classmethod
def translate_polymorphic_Q_object(cls, q):
return translate_polymorphic_Q_object(cls, q)