diff options
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 |
commit | 43f8b097420d610522eee8e80d48282b0ef1fcf9 (patch) | |
tree | 1b1c1f892152b95404511eec2b19eba7ee48ce68 /ishtar_common/wizards.py | |
parent | 3575ddb6a5bd9a00a2ac3064f0ba99259dc57af0 (diff) | |
download | Ishtar-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.py | 5 |
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 = {} |