Commits

Anonymous committed cad2bc1

Use get_by_lang in translate tag (improved performance)

Comments (0)

Files changed (1)

i18n_model/templatetags/i18n_model.py

 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