'Check that an inline with an editable ordering fields is
updated correctly. Regression for #10922'

def test_ordered_inline(self):

    Category.objects.create(id=1, order=1, collector=self.collector)
    Category.objects.create(id=2, order=2, collector=self.collector)
    Category.objects.create(id=3, order=0, collector=self.collector)
    Category.objects.create(id=4, order=0, collector=self.collector)
    self.post_data.update({u'name': u'Frederick    Clegg', u'category_set-TOTAL_FORMS': u'7', u'category_set-INITIAL_FORMS': u'4', u'category_set-MAX_NUM_FORMS': u'0', u'category_set-0-order': u'14', u'category_set-0-id': u'1', u'category_set-0-collector': u'1', u'category_set-1-order': u'13', u'category_set-1-id': u'2', u'category_set-1-collector': u'1', u'category_set-2-order': u'1', u'category_set-2-id': u'3', u'category_set-2-collector': u'1', u'category_set-3-order': u'0', u'category_set-3-id': u'4', u'category_set-3-collector': u'1', u'category_set-4-order': u'', u'category_set-4-id': u'', u'category_set-4-collector': u'1', u'category_set-5-order': u'', u'category_set-5-id': u'', u'category_set-5-collector': u'1', u'category_set-6-order': u'', u'category_set-6-id': u'', u'category_set-6-collector': u'1'})
    response = self.client.post(u'/test_admin/admin/admin_views/collector/1/', self.post_data)
    self.assertEqual(response.status_code, 302)
    self.assertEqual(self.collector.category_set.count(), 4)
    self.assertEqual(Category.objects.get(id=1).order, 14)
    self.assertEqual(Category.objects.get(id=2).order, 13)
    self.assertEqual(Category.objects.get(id=3).order, 1)
    self.assertEqual(Category.objects.get(id=4).order, 0)
