Try:

myB = B.objects.get(pk=1)
myCs = C.objects.filter(a__b=myB)

Regards
Scott

> I have model A in which there is field ForeignKey(B). I also have
> model C which inherits from model A. None of these models is abstract.
> Having B object, can I find all C objects pointing to it? When I use
> something like this: Bobject.C_set.all() there appears an error:
> 'AttributeError: B object has no attribute C_set'. Adding related_name
> to this foreignKey field in base class, for example "%(class)s", also
> doesn't help. I tried override this foreignKey field in subclass but I
> get clash error.
> I'm quite new to django and python. Any ideas what I am doing wrong?

-- 
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