You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would use the same convention as for tags: if it's a member just take it, if it's a callable call it everytime we need its value. This way we don't introduce a new get_xxx method, we just replace the xxx field by a callable :)
The tags solution looks good to me, if I understand correctly and if it gets implemented I should be able to do the following for a django model:
classMyTranslatableModel(models.Model):
language_code=models.CharField(max_length=2)
@property# Or any callable / attributedefindex_name(self):
return'index_name_{}'.format(self.language_code)
Hello there :)
Recently, I found myself in the needs to add multiple indexes per models, but in a dynamic way.
I used django-hvad for the model translations, and needed to "route" the models to a different index based on the
language_code
field of the model.Do you know how if there is a way I could achieve this ?
The text was updated successfully, but these errors were encountered: