Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #15549 -- Removed dependency on specific primary keys. Thanks t…

…o bberes for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15744 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4b746a6a2421bd22c3135ac2947b5f7370d2dd87 1 parent 185b4f4
@freakboy3742 freakboy3742 authored
Showing with 15 additions and 11 deletions.
  1. +15 −11 tests/regressiontests/model_formsets_regress/tests.py
View
26 tests/regressiontests/model_formsets_regress/tests.py
@@ -337,14 +337,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',
@@ -365,7 +357,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)
@@ -378,7 +374,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())
@@ -393,7 +393,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())
Please sign in to comment.
Something went wrong with that request. Please try again.