On 10/24/06, luxagraf <[EMAIL PROTECTED]> wrote:
>
> Russ-
>
> ah. okay that makes sense. I was assuming that entry_set was a
> contruct itself, but it's actually modelname_set...

Yup.

> So to make it purely abstract, things are working like this:
>
> response_obj = get_object_or_404(Model, param=value)
> response_obj.modelname_set.all().select_related()
>
> and I can just append as many models as have M2M relations with the
> first? Or is there a better way to do this?

You appear to be on the right track. Is there a better way? It depends
a bit on your application; however,

model_list = ModelName.objects.filter(response=response_obj)

might be slightly cleaner - it returns an empty list if there are no
models for a response, rather than the 404 exception that your
approach will yield (plus, it does it in a single query, rather than
two queries)

> Anyway thanks so much for your help, I've got it working now.

No problems. Glad I could help.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to