On Fri Jun 5 08:32:52 2015 GMT+0100, Cherie Pun wrote:
> 
> Thanks! Would this still give 404 errors when a certain object does not 
> exist?

Nope, but if you really need to ensure all ids exist in the database, compare 
the length of your level_ids with levels.count()
Make sure there are no duplicates in the id list (e.g. use set(level_ids)).

If they differ raise Http404 manually.

--
Florian
 
> On Tuesday, 2 June 2015 17:07:49 UTC+1, Simon Charette wrote:
> >
> > Hi Cherie,
> >
> > A `id__in` queryset lookup should issue a single query.
> >
> > levels = Level.objects.filter(id__in=level_ids)

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/jmuoos.npgoke.2ukv4q-qmf%40meitnerium.buergernetzwerk.at.
For more options, visit https://groups.google.com/d/optout.

Reply via email to