Friday, February 26, 2016

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

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 https://github.com/DheerendraRathor/Django-bugs/blob/master/prefetch_one/script.py

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. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/30f849ac-f2c9-4ddd-9f76-c3e38fbd5f2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment