Skip to content
Browse files

Fixed #10163: add an artificial ordering to querysets used by formset…

…s, thus ensuring that POSTed data "lines up" correctly every time. Thanks to Karen Tracey for pointing in the right direction here.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 855a58f commit 9ea2198fd1f2d0abf55373d8175dbb03f7440576 @jacobian jacobian committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 django/forms/
7 django/forms/
@@ -406,6 +406,13 @@ def get_queryset(self):
qs = self.queryset
qs = self.model._default_manager.get_query_set()
+ # If the queryset isn't already ordered we need to add an
+ # artificial ordering here to make sure that all formsets
+ # constructed from this queryset have the same form order.
+ if not qs.ordered:
+ qs = qs.order_by(
if self.max_num > 0:
self._queryset = qs[:self.max_num]

0 comments on commit 9ea2198

Please sign in to comment.
Something went wrong with that request. Please try again.