The Python Oracle

Django: check if value in values_list with & without prefetch_related/select_related

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 Django: Check If Value In Values_list With &Amp; Without Prefetch_related/Select_related
00:54 Accepted Answer Score 7
01:09 Thank you

--

Full question
https://stackoverflow.com/questions/1998...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #list #orm

#avk47



ACCEPTED ANSWER

Score 7


Are you using Django 1.5?

There was a bug that caused the in lookup to fail when using prefetch_related: bug 20242.

This has been fixed in Django 1.6.