TypeError: Related Field has invalid lookup: icontains
is there anyway to solve it and make it returns nothings instead of 500 error?
--
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net
SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928
Rispetta l'ambiente: se non ti è necessario, non stampare questa mail
When one tries to make a search in admin with a model table he gets this error:
TypeError: Related Field has invalid lookup: icontains
is there anyway to solve it and make it returns nothings instead of 500 error?
A part of my models.py:
http://dpaste.com/111580/
and my admin:
http://dpaste.com/111581/
Thanks in advance!
2009/1/21 Karen Tracey <kmtr...@gmail.com>:
A part of my models.py:> On Wed, Jan 21, 2009 at 10:21 AM, Alessandro Ronchi
> <alessand...@soasi.com> wrote:
>>
>> When one tries to make a search in admin with a model table he gets this
>> error:
>>
>> TypeError: Related Field has invalid lookup: icontains
>>
>> is there anyway to solve it and make it returns nothings instead of 500
>> error?
>
> Some details of the model and admin defs in use here would help someone help
> you.
>
> Karen
http://dpaste.com/111580/
and my admin:
http://dpaste.com/111581/
Thanks in advance!
> Egads, they're huge. Any way you could cut that down to a small failing
> example? Or at least mention which model you are trying the search on?
> Also a traceback instead of just the last error message would probably help,
> as it might give some clue where to start looking.
It falls on SchedaBilancioGenere model. I cannot replicate on a smaller model.
They're huge, but all the fields are not important: it seems if falls
on a related field.
This is the trackback:
http://dpaste.com/111757/
> Egads, they're huge. Any way you could cut that down to a small failingIt falls on SchedaBilancioGenere model. I cannot replicate on a smaller model.
> example? Or at least mention which model you are trying the search on?
> Also a traceback instead of just the last error message would probably help,
> as it might give some clue where to start looking.
They're huge, but all the fields are not important: it seems if falls
on a related field.
This is the trackback:
http://dpaste.com/111757/
> Ah, you have in your search_fields for SchedaBilancioGenereOptions
> 'impresa', which is a ForeignKey. You need to specify what field within the
> related model you want to search, so 'impresa__fieldname'. (If there are
> multiple fields you need to list each explicitly, using the standard
> double-underscore syntax.)
You was right!
Thanks a lot!