You can now define search_fields across relations as of:

https://github.com/stephenmcd/mezzanine/commit/a25927b1e4f8aaeaf6a7b85f6cd6d59212024627


On Wed, Feb 19, 2014 at 12:06 AM, step <[email protected]> wrote:

> Right, that those would be helpful :)  Here they are
>
> http://dpaste.com/1633572/<https://groups.google.com/d/topic/mezzanine-users/7mAZ1ziWsVY/unsubscribe>
>
> http://dpaste.com/1633594/
> - S
>
>
> On Tuesday, February 18, 2014 12:11:47 AM UTC-5, Stephen McDonald wrote:
>
>> Don't hoard your tracebacks, set them out free into the world!
>>
>> (please paste your full tracebacks somewhere)
>>
>>
>> On Tue, Feb 18, 2014 at 2:48 PM, step <[email protected]> wrote:
>>
>>> Hey guys, I can't figure this out.  I figured this might be something
>>> worth resolving on the mailing list as a reference.
>>> I'm trying to use a foreignkey in a Model's search_fields (search using
>>> a foreignkey).
>>>
>>> Anyone have any idea?
>>>
>>> *settings.py*
>>> -----
>>> (
>>>     # Dotted path to field.
>>>     "cartridge.shop.models.Product.artist",
>>>     # Dotted path to field class.
>>>     "ForeignKey",
>>>     # Positional args for field class.
>>>     ("app.Artist",),
>>>     # Keyword args for field class.
>>>     {"blank": False},
>>> )
>>>
>>> *OPTION 1.*
>>>
>>> patches.py
>>> ----
>>> Product.search_fields = {'keywords_string': 10, 'title': 5, 'artist': 5}
>>>
>>> results in
>>> ----
>>> "Related Field got invalid lookup: icontains"
>>>
>>>
>>> *OPTION 2*
>>>
>>> patches.py
>>> ----
>>> Product.search_fields = {'keywords_string': 10, 'title': 5,
>>> 'artist__title': 5}
>>>
>>> results in
>>> ----
>>> "'Product' object has no attribute 'artist__title'"
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Stephen McDonald
>> http://jupo.org
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to