Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Russell Keith-Magee authored March 04, 2011
26  tests/regressiontests/model_formsets_regress/tests.py
@@ -337,14 +337,6 @@ def should_delete(self):
337 337
             'form-3-serial': '5',
338 338
             }
339 339
 
340  
-    bound_ids = {
341  
-            'form-INITIAL_FORMS': '4',
342  
-            'form-0-id': '1',
343  
-            'form-1-id': '2',
344  
-            'form-2-id': '3',
345  
-            'form-3-id': '4',
346  
-            }
347  
-
348 340
     delete_all_ids = {
349 341
             'form-0-DELETE': '1',
350 342
             'form-1-DELETE': '1',
@@ -365,7 +357,11 @@ def test_no_delete(self):
365 357
 
366 358
         # pass standard data dict & see none updated
367 359
         data = dict(self.data)
368  
-        data.update(self.bound_ids)
  360
+        data['form-INITIAL_FORMS'] = 4
  361
+        data.update(dict(
  362
+            ('form-%d-id' % i, user.id)
  363
+            for i,user in enumerate(User.objects.all())
  364
+        ))
369 365
         formset = self.NormalFormset(data, queryset=User.objects.all())
370 366
         self.assertTrue(formset.is_valid())
371 367
         self.assertEqual(len(formset.save()), 0)
@@ -378,7 +374,11 @@ def test_all_delete(self):
378 374
 
379 375
         # create data dict with all fields marked for deletion
380 376
         data = dict(self.data)
381  
-        data.update(self.bound_ids)
  377
+        data['form-INITIAL_FORMS'] = 4
  378
+        data.update(dict(
  379
+            ('form-%d-id' % i, user.id)
  380
+            for i,user in enumerate(User.objects.all())
  381
+        ))
382 382
         data.update(self.delete_all_ids)
383 383
         formset = self.NormalFormset(data, queryset=User.objects.all())
384 384
         self.assertTrue(formset.is_valid())
@@ -393,7 +393,11 @@ def test_custom_delete(self):
393 393
         # Create formset with custom Delete function
394 394
         # create data dict with all fields marked for deletion
395 395
         data = dict(self.data)
396  
-        data.update(self.bound_ids)
  396
+        data['form-INITIAL_FORMS'] = 4
  397
+        data.update(dict(
  398
+            ('form-%d-id' % i, user.id)
  399
+            for i,user in enumerate(User.objects.all())
  400
+        ))
397 401
         data.update(self.delete_all_ids)
398 402
         formset = self.DeleteFormset(data, queryset=User.objects.all())
399 403
 

0 notes on commit 4b746a6

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