Haystack indexing related model issue
问题 I want to prepare an index for two models, so I can search text from both models. Below is my code. When I run "python manage.py rebuild_index" I get the error "raise self.related.model.DoesNotExist" for the index line "return obj.mainparts.parts". models.py class Main(models.Model): ....#various fields class Parts(models.Model): main = models.OneToOneField(Main, primary_key=True, related_name='mainparts') parts = models.TextField(blank=True) search_indexes.py class MainIndex(indexes