summaryrefslogtreecommitdiff
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
commitc15a0ab8fa195ea8896d0c91ec8f75bf65805cdf (patch)
tree1b1c1f892152b95404511eec2b19eba7ee48ce68
parent186390697b6c2a749d09518d0116210d7565c440 (diff)
downloadIshtar-c15a0ab8fa195ea8896d0c91ec8f75bf65805cdf.tar.bz2
Ishtar-c15a0ab8fa195ea8896d0c91ec8f75bf65805cdf.zip
Ordering of formset items martch to the meta ordering if available otherwise ordered by pk (refs #1595)
-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 = {}