On Mar 17, 4:37 am, TheIvIaxx <theivi...@gmail.com> wrote:
> i suppose i could, but that will be a last resort :)  What about
> dropping down to raw SQL just to get the IDs:
>
> SELECT term_id FROM image_term WHERE image_id = %i
>
> or is that discouraged?  Can it be done with the ORM?

You'd have the exact same result using the ORM:

   ids = image.terms.values_list('id', flat=True)

but this won't solve the real problem of doing images.count() queries
- which is what select_related is for.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to