私は2つのモデルを持っています:
- ダイエット
- 製品
Diet
を参照する外部キーがありますProduct
。
Product
と呼ばれる翻訳可能なフィールドがありname
ます。
このクエリを実行したい:
Diet.objects.language().get(product__name='Some name')
ただし、次のエラーが発生します。
WrongManager at /alimentazione-vie-urinarie
Accessing translated fields like product.name from an regular model requires a translation-aware queryset,
obtained with the .language() method.
For regular, non-translatable models, you can get one using hvad.utils.get_translation_aware_manager
古い同様の質問を見つけましたが、答えがうまくいきませんでした。