On 4/28/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote:
> class Servico(meta.Model):
> ~ codigo = meta.TextField(maxlength=4)
> ~ nome = meta.CharField(maxlength=80)
>
> ~ def __repr__(self):
> ~ return self.nome
>
> class Cadastro(meta.Model):
> ~ serv_clientes = meta.ForeignKey(Servico)
> ~ nome = meta.CharField(maxlength=200)
> ~ (...)
> ~ def __repr__(self):
> ~ return self.nome
>
> when I try:
> lista_sps = cadastros.get_list(servicos__id__exact=2)
> from within a view, I get:
>
> TypeError at /cadastro/pesquisa/
> got unexpected keyword argument 'servicos__id__exact'
Hi Luis,
When using the Django database API, you use the field names, not the
model names. So you want this:
cadastros.get_list(serv_clientes__id__exact=2)
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---