3 level nested prefetch is not working as expected on Django 1.8.x

94 views
Skip to first unread message

Dheerendra Rathor

unread,
Feb 27, 2016, 1:03:57 AM2/27/16
to Django developers (Contributions to Django itself)
Posting this from django-users https://groups.google.com/forum/#!topic/django-users/v3KelvexqiI.

Three level nested prefetch with custom queryset throws an Attribute Error. It works perfectly fine on Django 1.9 but I was unable to find release notes or bug fix notes of the same. 

To reproduce: 
1. Install Django 1.8.6+

It throws: AttributeError: Cannot find 'videos' on QuizMarker object, 'videos__markers__quiz__quiz_histories' is an invalid parameter to prefetch_related()
however, running the same with Django 1.9 works fine as expected. 

 

Shai Berger

unread,
Feb 27, 2016, 9:38:17 AM2/27/16
to django-d...@googlegroups.com
Hi,

Thanks for taking the time to report this and prepare a detailed test case.
However, per our support policy[1], Django 1.8 is now at a stage where the
only fixes we apply to it are security fixes and bug-fixes for data-loss issues.
As far as I understand from your description, this does not fall into these
categories, so we will not fix this in 1.8.x.

Going forward, there is a test in current master assuring that this works
(look for "# Test inner prefetch" in django/tests/prefetch_related/tests.py),
so I don't think there is anything left to do about this.

Sorry for your trouble,

Shai.

[1] https://docs.djangoproject.com/en/1.9/internals/release-process/

On Saturday 27 February 2016 08:03:57 Dheerendra Rathor wrote:
> Posting this from
> django-users
> https://groups.google.com/forum/#!topic/django-users/v3KelvexqiI.
>
> Three level nested prefetch with custom queryset throws an Attribute Error.
>
> > It works perfectly fine on Django 1.9 but I was unable to find release
> > notes or bug fix notes of the same.
> >
> > To reproduce:
> > 1. Install Django 1.8.6+
> > 2. Add models from
> > https://github.com/DheerendraRathor/Django-bugs/blob/master/prefetch_one/
> > models.py 3. Run the script from
Reply all
Reply to author
Forward
0 new messages