On Fri, Oct 17, 2014 at 2:53 PM, Taenyon Kim <xos...@gmail.com> wrote:

> Example
>
> class ModelA(models.Model):
>     fielda = models.CharField(max_length=10)
>
> class ModelB(models.Model):
>     modela = models.ForeignKey(ModelA)
>     fieldb = models.CharField(max_length=10)
>
>
> When I query like "modela_instance.modelb_set()", then I will get
> KeyError: u'manager' as shown below:
>

AFAIK, you want something like "modela_instance.modelb_set.all()" - just
modela_instance.modelb_set() is the manager instance that you call call
methods on (like 'all', 'filter', etc.), but calling the manager directly
doesn't quite work, as you found out :)

All the best,
Sanjay

-- 
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/CAG3W7ZEsi_7iYJP8k2s7ADjZt%2BtCXD2Mkatvrjx1_D%3Do5v%3D%3D_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to