summaryrefslogtreecommitdiff
path: root/django/forms/formsets.py
diff options
context:
space:
mode:
authorArthur Koziel <arthur@arthurkoziel.com>2010-09-13 00:04:27 +0000
committerArthur Koziel <arthur@arthurkoziel.com>2010-09-13 00:04:27 +0000
commitdd49269c7db008b2567f50cb03c4d3d9b321daa1 (patch)
tree326dd25bb045ac016cda7966b43cbdfe1f67d699 /django/forms/formsets.py
parentc9b188c4ec939abbe48dae5a371276742e64b6b8 (diff)
downloaddjango-soc2010/app-loading.tar.gz
[soc2010/app-loading] merged trunkarchive/soc2010/app-loadingsoc2010/app-loading
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/app-loading@13818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/formsets.py')
-rw-r--r--django/forms/formsets.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 3804f2b3c1..508950eee9 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -199,14 +199,12 @@ class BaseFormSet(StrAndUnicode):
# A sort function to order things numerically ascending, but
# None should be sorted below anything else. Allowing None as
# a comparison value makes it so we can leave ordering fields
- # blamk.
- def compare_ordering_values(x, y):
- if x[1] is None:
- return 1
- if y[1] is None:
- return -1
- return x[1] - y[1]
- self._ordering.sort(compare_ordering_values)
+ # blank.
+ def compare_ordering_key(k):
+ if k[1] is None:
+ return (1, 0) # +infinity, larger than any number
+ return (0, k[1])
+ self._ordering.sort(key=compare_ordering_key)
# Return a list of form.cleaned_data dicts in the order spcified by
# the form data.
return [self.forms[i[0]] for i in self._ordering]