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
Django has a feature they call the “default manager” that creates the “default queryset”.
Thus, the setting is so named because it instructs hvad to use that feature to set itself to provide the default queryset for translated models. Maybe not the best name ever, but changing it now would break all projects using it, so it's there to stay.
It is not enabled by default, because it is incompatible with some third-party apps and addons. Hvad tends to lean towards safe defaults.
As a reminder, when you have a translatable model, there are three ways to get a queryset from the hvad's manager:
MyModel.objects.language() # always translation awareMyModel.objects.get_queryset() # default queryset. Hvad-enabled if USE_DEFAULT_QUERYSET.MyModel.objects.untranslated() # never translation aware
All direct uses of queryset methods (filter, order_by, ...) are forwarded to .get_queryset().method().
Translation-aware apps should always use .language() or .untranslated().
Translation-unaware apps will use the usual API, which means they will use get_queryset(). USE_DEFAULT_QUERYSET makes it possible to choose whether that will be the same as language() or the same as untranslated().
When I read
USE_DEFAULT_QUERYSET
, I understand "Use Django's default queryset? Yes/No".So when I set it to
True
to tell hvad to use a translation-aware queryset, it doesn't make sense to me.I would either rename it to something more explicit like
USE_TRANSLATION_AWARE_QUERYSET
, or invert it.Also, why is it off by default? Of course I want translation-aware querysets, otherwise I wouldn't have installed hvad.
The text was updated successfully, but these errors were encountered: