1. Branko Vukelic
  2. django-i18n-model

Commits

Hajime Yamasaki  committed cad2bc1

Use get_by_lang in translate tag (improved performance)

  • Participants
  • Parent commits 4fd63f1
  • Branches master

Comments (0)

Files changed (1)

File i18n_model/templatetags/i18n_model.py

View file
 def translate(obj, language=None):
     language = language or get_language()
     try:
-        return obj.translations.lang(language).get()
+        return obj.translations.get_by_lang(language)
     except:
         return obj