Tuesday, June 25, 2013

Re: Missing Related Objects in MODEL._meta.get_all_related_objects

On Thursday, 17 February 2011 17:09:26 UTC+1, Martin Siniawski wrote:
Hey!

So we have a certain model which is related with many other models, by
ForeignKey fields set in those other models.

The setup is not particularly exotic, but for some reason, when
using ._meta.get_all_related_objects() on the model which has all the
ForeignKey fields pointing at it, some of the related objects that
should be returned are missing.

This is an old thread, but since I solved a similar problem I thought I'd reply anyway.

What you are looking for is probably get_all_related_many_to_many_objects(). "get_all_related_objects" really just means "get_all_related_foreginkey_objects", so that could explain that some fields are missing.

/Emil

--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate