Skip to content

Version 1.8.0

Latest
Compare
Choose a tag to compare
@spectras spectras released this 28 Apr 17:50
· 1 commit to master since this release
1.8.0

Python and Django versions supported:

  • Support for Django 1.10 was added.
  • Django 1.7 is no longer supported.
  • So, as a reminder, supported Django versions for this release are:
    1.8 LTS, 1.9, 1.10.x (for x ≥ 1) and 1.11.

New features:

  • Automatic loading of translations on attribute access can now be disabled, by setting HVAD["AUTOLOAD_TRANSLATIONS"] to False. This will prevent hvad from initiating database queries. Accessing translatable attributes with no translation loaded will then raise an AttributeError.
  • It is possible to automatically install TranslationQueryset as the default queryset for all translatable models, by setting HVAD["USE_DEFAULT_QUERYSET"] to True. Specifically, it changes TranslationManager.default_class to be a TranslationQueryset instead of Django's QuerySet.
    See the section about overriding the default queryset for advantages and caveats of doing so.
  • Field declaration for internal language_code attribute can be overriden. — #332.

Compatibility warnings:

  • All settings have been moved to a unique HVAD dictionary. Please update your django settings accordingly.
  • Deprecated class FallbackQueryset has been removed. Using it along with use_fallbacks() did not work on Django 1.9 and newer and was deprecated on older versions. Using it without that method made it behave like a regular queryset. So as a summary,
    • Code using .untranslated().use_fallbacks() must be replaced with .language().fallbacks().
    • All other uses of FallbackQueryset can be safely replaced with a regular Django QuerySet.
  • Translated admin no longer shows objects lacking a translation. This was already the case on Django 1.9 and newer, and this behavior now extends to all Django versions. Such objects should not happen anyway, and throw a warning when encountered.

Fixes:

  • Increase speed of translated attribute access by ~30%, by avoiding a method call when a translation is loaded.
  • Attempting to use a reserved name for a translated field now raises an ImproperlyConfigured exception instead of silently ignoring the field.
  • Instances created by serializers using REST TranslatableModelMixin in normal, non-enforcing mode can no longer be created without a translation — #322.