Skip to content Skip to sidebar Skip to footer

Django Hvad Query Translatablemodel

I am using Hvad to make translatable models but I am getting an error trying to fetch a model. I have two models classes like these: class Boy(TranslatableModel): age = models.Po

Solution 1:

Unfortunately, for now, deep translated arguments are not supported. It is something that might change for the next big rewrite of hvad, but there is no schedule for it yet. (it's implemented on a development branch but too buggy to make it to master)

In the meantime, a nested query should work:

Boy = Boy.objects.language('en').filter(name="john", toy__in=Toy.objects.language('en').filter(model_name="car"))

If using postgresql, the performance should not change much, postgresql is clever enough to optimize this correctly.

Post a Comment for "Django Hvad Query Translatablemodel"