I have the exact same problem. Stephen is there any other solution
different from just copying it to keywords/description or even one custom
text field? (redundant)
However this may slightly increase DB storage, but in terms of performance
it will be a bit faster, not having to join the extra table when searching.
On Tuesday, February 18, 2014 5:48:21 AM UTC+2, step 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.