Changeset - c22bcf9cf464
[Not reviewed]
0 1 0
Hiroshi Miura - 9 years ago 2015-07-20 03:03:54
miurahr@linux.com
fix OrderedDict import error in Py2.6

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
symposion/forms.py
Show inline comments
 
from collections import OrderedDict
 
try:
 
    from collections import OrderedDict
 
except ImportError:
 
    OrderedDict = None
 

	
 
from django import forms
 
from django import VERSION as django_VERSION
 

	
 
import account.forms
 

	
...
 
@@ -46,7 +48,7 @@ def reorder_fields(fields, order):
 
        if key not in order:
 
            del fields[key]
 

	
 
    if django_VERSION < (1, 7, 0):
 
    if not OrderedDict or hasattr(fields, "keyOrder"):
 
        # fields is SortedDict
 
        fields.keyOrder.sort(key=lambda k: order.index(k[0]))
 
        return fields
0 comments (0 inline, 0 general)