Skip to content

Commit

Permalink
[1.2.X] Fixed #15549 -- Removed dependency on specific primary keys. …
Browse files Browse the repository at this point in the history
…Thanks to bberes for the report.

Backport of r15744 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15747 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Mar 4, 2011
1 parent a1697e8 commit d9b9684
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions tests/regressiontests/model_formsets_regress/tests.py
Expand Up @@ -329,14 +329,6 @@ def should_delete(self):
'form-3-serial': '5',
}

bound_ids = {
'form-INITIAL_FORMS': '4',
'form-0-id': '1',
'form-1-id': '2',
'form-2-id': '3',
'form-3-id': '4',
}

delete_all_ids = {
'form-0-DELETE': '1',
'form-1-DELETE': '1',
Expand All @@ -357,7 +349,11 @@ def test_no_delete(self):

# pass standard data dict & see none updated
data = dict(self.data)
data.update(self.bound_ids)
data['form-INITIAL_FORMS'] = 4
data.update(dict(
('form-%d-id' % i, user.id)
for i,user in enumerate(User.objects.all())
))
formset = self.NormalFormset(data, queryset=User.objects.all())
self.assertTrue(formset.is_valid())
self.assertEqual(len(formset.save()), 0)
Expand All @@ -370,7 +366,11 @@ def test_all_delete(self):

# create data dict with all fields marked for deletion
data = dict(self.data)
data.update(self.bound_ids)
data['form-INITIAL_FORMS'] = 4
data.update(dict(
('form-%d-id' % i, user.id)
for i,user in enumerate(User.objects.all())
))
data.update(self.delete_all_ids)
formset = self.NormalFormset(data, queryset=User.objects.all())
self.assertTrue(formset.is_valid())
Expand All @@ -385,7 +385,11 @@ def test_custom_delete(self):
# Create formset with custom Delete function
# create data dict with all fields marked for deletion
data = dict(self.data)
data.update(self.bound_ids)
data['form-INITIAL_FORMS'] = 4
data.update(dict(
('form-%d-id' % i, user.id)
for i,user in enumerate(User.objects.all())
))
data.update(self.delete_all_ids)
formset = self.DeleteFormset(data, queryset=User.objects.all())

Expand Down

0 comments on commit d9b9684

Please sign in to comment.