ojii / django-multilingual-ng

THIS PROJECT IS *NOT* SUPPORTED AND SHOULD NOT BE USED UNLESS YOU KNOW EXACTLY WHAT YOU'RE DOING!!!

Home Page:https://github.com/KristianOellegaard/django-hvad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple fix for field ordering bug in admin

OleLaursen opened this issue · comments

The translated fields don't appear in the right order in the admin, i.e. the order they were specified in the model. This is because they are retrieved from a dictionary. Here's a simple fix (I've also put it here http://people.iola.dk/olau/misc/multilingual-admin-ordering.patch):

Index: admin.py
===================================================================
--- admin.py    (revision 6214)
+++ admin.py    (working copy)
@@ -410,6 +410,7 @@

 def get_default_translated_fields(model):
     if hasattr(model._meta, 'translation_model'):
-        for name, (field, non_default) in model._meta.translation_model._meta.translated_fields.items():
-            if not non_default:
-                yield name, field
+        tf = model._meta.translation_model._meta.translated_fields
+        for f in model._meta.translation_model._meta.fields:
+            if f.name in tf:
+                yield f.name, f