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@ed0ff913c6fix_request_path_info
parent
6fe1e2ddae
commit
fc8cabfa26
|
|
@ -23,8 +23,6 @@ class PolymorphicManager(models.Manager):
|
||||||
Usually not explicitly needed, except if a custom manager or
|
Usually not explicitly needed, except if a custom manager or
|
||||||
a custom queryset class is to be used.
|
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
|
queryset_class = PolymorphicQuerySet
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
||||||
|
|
@ -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
|
# for PolymorphicQuery, True => an overloaded __repr__ with nicer multi-line output is used by PolymorphicQuery
|
||||||
polymorphic_query_multiline_output = False
|
polymorphic_query_multiline_output = False
|
||||||
|
|
||||||
class Meta:
|
|
||||||
abstract = True
|
|
||||||
|
|
||||||
# avoid ContentType related field accessor clash (an error emitted by model validation)
|
# 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.
|
#: The model field that stores the :class:`~django.contrib.contenttypes.models.ContentType` reference to the actual class.
|
||||||
polymorphic_ctype = models.ForeignKey(
|
polymorphic_ctype = models.ForeignKey(
|
||||||
|
|
@ -58,6 +55,10 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
|
||||||
objects = PolymorphicManager()
|
objects = PolymorphicManager()
|
||||||
base_objects = models.Manager()
|
base_objects = models.Manager()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
base_manager_name = "objects"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def translate_polymorphic_Q_object(cls, q):
|
def translate_polymorphic_Q_object(cls, q):
|
||||||
return translate_polymorphic_Q_object(cls, q)
|
return translate_polymorphic_Q_object(cls, q)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue