summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-07-21 12:09:53 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2014-07-21 12:09:53 +0200
commit43f8b097420d610522eee8e80d48282b0ef1fcf9 (patch)
tree1b1c1f892152b95404511eec2b19eba7ee48ce68 /ishtar_common/wizards.py
parent3575ddb6a5bd9a00a2ac3064f0ba99259dc57af0 (diff)
downloadIshtar-43f8b097420d610522eee8e80d48282b0ef1fcf9.tar.bz2
Ishtar-43f8b097420d610522eee8e80d48282b0ef1fcf9.zip
Ordering of formset items martch to the meta ordering if available otherwise ordered by pk (refs #1595)
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 368c6e627..190a7fc86 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -750,7 +750,10 @@ class Wizard(NamedUrlWizardView):
if not hasattr(obj, key):
return initial
keys = c_form.form.base_fields.keys()
- for child_obj in getattr(obj, key).order_by('pk').all():
+ query = getattr(obj, key)
+ if not obj._meta.ordering:
+ query = query.order_by('pk')
+ for child_obj in query.all():
if not keys:
break
vals = {}