#19652: Fix for #19524 introduced a backward compatiblity issue with related
managers on 1.5.X
---------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: Bug | Status: new
Component: ORM aggregation | Version: 1.5-beta-1
Severity: Normal | Keywords: none EmptyQuerySet none
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
The fix for #19524 which was
[https://github.com/django/django/commit/5097d3c5faab2b6582c4cebee2b265fcdbb893eb#L1R698
backported] to the 1.5.X branch caused the following regression:
{{{
#!python
class ObjectQuerySet(models.query.QuerySet):
def extra_qs_method(self):
pass
class ObjectManager(models.Manager):
use_for_related_fields = True
def get_query_set(self):
return ObjectQuerySet(self.model, using=self._db)
class RelatedObject(models.Model):
pass
class Object(models.Model):
related = models.ForeignKey(RelatedObject, related_name='objs')
objects = ObjectManager()
RelatedObject().objs.extra_qs_method()
}}}
Raises
{{{
AttributeError: 'EmptyQuerySet' object has no attribute 'extra_qs_method'
}}}
It works perfectly on `master` since `QuerySet.none()` returns an instance
of the correct class while setting it's underlying's query to empty and on
< 1.5.X since prior to this backport there was no `instance.pk`
[https://github.com/django/django/commit/5097d3c5faab2b6582c4cebee2b265fcdbb893eb#L1R695
check] to return an `EmptyQuerySet`.
--
Ticket URL: <https://code.djangoproject.com/ticket/19652>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.