Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #8542 -- Made the model_formstests tests from [8528] a little less

dependent upon the precise values of auto-created primary key integers.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d5f1d6f937ea1649fce97c99b07f82b55cec1e01 1 parent 4df380f
Malcolm Tredinnick authored August 25, 2008

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  tests/modeltests/model_formsets/models.py
5  tests/modeltests/model_formsets/models.py
@@ -254,19 +254,20 @@ class CustomPrimaryKey(models.Model):
254 254
 True
255 255
 >>> formset.save()
256 256
 [<BetterAuthor: Ernest Hemingway>]
  257
+>>> hemingway_id = BetterAuthor.objects.get(name="Ernest Hemingway").pk
257 258
 
258 259
 >>> formset = BetterAuthorFormSet()
259 260
 >>> for form in formset.forms:
260 261
 ...     print form.as_p()
261 262
 <p><label for="id_form-0-name">Name:</label> <input id="id_form-0-name" type="text" name="form-0-name" value="Ernest Hemingway" maxlength="100" /></p>
262  
-<p><label for="id_form-0-write_speed">Write speed:</label> <input type="text" name="form-0-write_speed" value="10" id="id_form-0-write_speed" /><input type="hidden" name="form-0-author_ptr_id" value="4" id="id_form-0-author_ptr_id" /></p>
  263
+<p><label for="id_form-0-write_speed">Write speed:</label> <input type="text" name="form-0-write_speed" value="10" id="id_form-0-write_speed" /><input type="hidden" name="form-0-author_ptr_id" value="..." id="id_form-0-author_ptr_id" /></p>
263 264
 <p><label for="id_form-1-name">Name:</label> <input id="id_form-1-name" type="text" name="form-1-name" maxlength="100" /></p>
264 265
 <p><label for="id_form-1-write_speed">Write speed:</label> <input type="text" name="form-1-write_speed" id="id_form-1-write_speed" /><input type="hidden" name="form-1-author_ptr_id" id="id_form-1-author_ptr_id" /></p>
265 266
 
266 267
 >>> data = {
267 268
 ...     'form-TOTAL_FORMS': '2', # the number of forms rendered
268 269
 ...     'form-INITIAL_FORMS': '1', # the number of forms with initial data
269  
-...     'form-0-author_ptr_id': '4',
  270
+...     'form-0-author_ptr_id': hemingway_id,
270 271
 ...     'form-0-name': 'Ernest Hemingway',
271 272
 ...     'form-0-write_speed': '10',
272 273
 ...     'form-1-author_ptr_id': '',

0 notes on commit d5f1d6f

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