Answer the question
In order to leave comments, you need to log in
Django haystack how to setup lookup for intermediate models with foreign key?
Hello. For one of my projects, I'm adding a search for django haystack c solr.
There was a question how to search through foreign key.
# Модель по которой осуществляется поиск
class ItemModel(models.Model):
name = models.CharField(max_length=255)
# Категория
class CategoryModel(models.Model):
name = models.CharField(max_length=255)
# Связь между item и категорией
class ItemToCategoryModel(models.Model):
item = models.ForeignKey('ItemModel')
category = models.ForeignKey('CategoryModel')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question