Django如何让干草堆与django-hvad合作

时间:2015-04-27 20:19:43

标签: python django django-haystack django-hvad

我正在开发一个多语言应用程序,我需要实现一个搜索引擎,我选择了haystack。

这是我要索引的模型

class Post(TranslatableModel):
    category = models.ForeignKey(
        Category,
        related_name='posts',
        verbose_name=_(u'Categoría')
    )
    slug = AutoSlugField(
        populate_from='title'
    )
    featured_picture = ThumbnailerImageField(
        upload_to='blog/posts/featured-pictures',
        verbose_name=_(u'Imagen destacada'),
        help_text=_(u'Tamaño: 850 x 423px. Será recordada si no.')
    )
    box_bg = models.CharField(
        max_length=20,
        verbose_name=_(u'Color de fondo de la caja'),
        choices=SERVICE_BOX_COLORS,
        # Could be an image
        null=True, blank=True
    )
    box_image_bg = ThumbnailerImageField(
        upload_to='blog/posts/background-images',
        verbose_name=_(u'Imagen de fondo de la caja'),
        null=True, blank=True,
        help_text=_(u'Tamaño: 500 x 500px. Será recordada si no.')
    )

    translations = TranslatedFields(
        title=models.CharField(
            max_length=100,
            verbose_name=_(u'Título')
        ),
        content=RichTextField(
            verbose_name=_(u'Contenido')
        ),
        meta_description=models.TextField(
            verbose_name=_(u'Meta description (SEO)'),
            help_text=_(u'Máximo 160 caracteres.'),
            max_length=160
        )
    )

我不知道在haystack中如何处理hvad翻译字段

0 个答案:

没有答案