Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replaced dict reprs in tests with explicit looks at each key. This sh…

…ould fix many spurious test failures on other VMs (first noticed on Jython).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7322 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit bc1f67a6de45fe2ebfdf69ba449295066f365419 1 parent 6035af8
Jacob Kaplan-Moss authored March 19, 2008
5  tests/modeltests/custom_pk/models.py
@@ -71,8 +71,9 @@ def __unicode__(self):
71 71
 >>> fran.save()
72 72
 >>> Employee.objects.filter(last_name__exact='Jones')
73 73
 [<Employee: Dan Jones>, <Employee: Fran Jones>]
74  
->>> Employee.objects.in_bulk(['ABC123', 'XYZ456'])
75  
-{u'XYZ456': <Employee: Fran Jones>, u'ABC123': <Employee: Dan Jones>}
  74
+>>> emps = Employee.objects.in_bulk(['ABC123', 'XYZ456'])
  75
+>>> emps['ABC123']
  76
+<Employee: Dan Jones>
76 77
 
77 78
 >>> b = Business(name='Sears')
78 79
 >>> b.save()
7  tests/modeltests/lookup/models.py
@@ -76,8 +76,11 @@ def __unicode__(self):
76 76
 
77 77
 # in_bulk() takes a list of IDs and returns a dictionary mapping IDs
78 78
 # to objects.
79  
->>> Article.objects.in_bulk([1, 2])
80  
-{1: <Article: Article 1>, 2: <Article: Article 2>}
  79
+>>> arts = Article.objects.in_bulk([1, 2])
  80
+>>> arts[1]
  81
+<Article: Article 1>
  82
+>>> arts[2]
  83
+<Article: Article 2>
81 84
 >>> Article.objects.in_bulk([3])
82 85
 {3: <Article: Article 3>}
83 86
 >>> Article.objects.in_bulk([1000])
28  tests/modeltests/manipulators/models.py
@@ -41,25 +41,33 @@ def __unicode__(self):
41 41
 True
42 42
 
43 43
 # Attempt to add a Musician without a first_name.
44  
->>> man.get_validation_errors(MultiValueDict({'last_name': ['Blakey']}))
45  
-{'first_name': [u'This field is required.']}
  44
+>>> man.get_validation_errors(MultiValueDict({'last_name': ['Blakey']}))['first_name']
  45
+[u'This field is required.']
46 46
 
47 47
 # Attempt to add a Musician without a first_name and last_name.
48  
->>> man.get_validation_errors(MultiValueDict({}))
49  
-{'first_name': [u'This field is required.'], 'last_name': [u'This field is required.']}
  48
+>>> errors = man.get_validation_errors(MultiValueDict({}))
  49
+>>> errors['first_name']
  50
+[u'This field is required.']
  51
+>>> errors['last_name']
  52
+[u'This field is required.']
50 53
 
51 54
 # Attempt to create an Album without a name or musician.
52 55
 >>> man = Album.AddManipulator()
53  
->>> man.get_validation_errors(MultiValueDict({}))
54  
-{'musician': [u'This field is required.'], 'name': [u'This field is required.']}
  56
+>>> errors = man.get_validation_errors(MultiValueDict({}))
  57
+>>> errors['musician']
  58
+[u'This field is required.']
  59
+>>> errors['name']
  60
+[u'This field is required.']
55 61
 
56 62
 # Attempt to create an Album with an invalid musician.
57  
->>> man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['foo']}))
58  
-{'musician': [u"Select a valid choice; 'foo' is not in [u'', u'1']."]}
  63
+>>> errors = man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['foo']}))
  64
+>>> errors['musician']
  65
+[u"Select a valid choice; 'foo' is not in [u'', u'1']."]
59 66
 
60 67
 # Attempt to create an Album with an invalid release_date.
61  
->>> man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['1'], 'release_date': 'today'}))
62  
-{'release_date': [u'Enter a valid date in YYYY-MM-DD format.']}
  68
+>>> errors = man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['1'], 'release_date': 'today'}))
  69
+>>> errors['release_date']
  70
+[u'Enter a valid date in YYYY-MM-DD format.']
63 71
 
64 72
 # Create an Album without a release_date (because it's optional).
65 73
 >>> data = MultiValueDict({'name': ['Ella and Basie'], 'musician': ['1']})
36  tests/modeltests/model_forms/models.py
@@ -234,8 +234,12 @@ def __unicode__(self):
234 234
 >>> f = CategoryForm({'name': 'Entertainment', 'slug': 'entertainment', 'url': 'entertainment'})
235 235
 >>> f.is_valid()
236 236
 True
237  
->>> f.cleaned_data
238  
-{'url': u'entertainment', 'name': u'Entertainment', 'slug': u'entertainment'}
  237
+>>> f.cleaned_data['url']
  238
+u'entertainment'
  239
+>>> f.cleaned_data['name']
  240
+u'Entertainment'
  241
+>>> f.cleaned_data['slug']
  242
+u'entertainment'
239 243
 >>> obj = f.save()
240 244
 >>> obj
241 245
 <Category: Entertainment>
@@ -245,8 +249,12 @@ def __unicode__(self):
245 249
 >>> f = CategoryForm({'name': "It's a test", 'slug': 'its-test', 'url': 'test'})
246 250
 >>> f.is_valid()
247 251
 True
248  
->>> f.cleaned_data
249  
-{'url': u'test', 'name': u"It's a test", 'slug': u'its-test'}
  252
+>>> f.cleaned_data['url']
  253
+u'test'
  254
+>>> f.cleaned_data['name']
  255
+u"It's a test"
  256
+>>> f.cleaned_data['slug']
  257
+u'its-test'
250 258
 >>> obj = f.save()
251 259
 >>> obj
252 260
 <Category: It's a test>
@@ -259,8 +267,12 @@ def __unicode__(self):
259 267
 >>> f = CategoryForm({'name': 'Third test', 'slug': 'third-test', 'url': 'third'})
260 268
 >>> f.is_valid()
261 269
 True
262  
->>> f.cleaned_data
263  
-{'url': u'third', 'name': u'Third test', 'slug': u'third-test'}
  270
+>>> f.cleaned_data['url']
  271
+u'third'
  272
+>>> f.cleaned_data['name']
  273
+u'Third test'
  274
+>>> f.cleaned_data['slug']
  275
+u'third-test'
264 276
 >>> obj = f.save(commit=False)
265 277
 >>> obj
266 278
 <Category: Third test>
@@ -272,8 +284,10 @@ def __unicode__(self):
272 284
 
273 285
 If you call save() with invalid data, you'll get a ValueError.
274 286
 >>> f = CategoryForm({'name': '', 'slug': '', 'url': 'foo'})
275  
->>> f.errors
276  
-{'name': [u'This field is required.'], 'slug': [u'This field is required.']}
  287
+>>> f.errors['name']
  288
+[u'This field is required.']
  289
+>>> f.errors['slug']
  290
+[u'This field is required.']
277 291
 >>> f.cleaned_data
278 292
 Traceback (most recent call last):
279 293
 ...
@@ -739,8 +753,10 @@ def __unicode__(self):
739 753
 >>> f = PhoneNumberForm({'phone': '(312) 555-1212', 'description': 'Assistance'})
740 754
 >>> f.is_valid()
741 755
 True
742  
->>> f.cleaned_data
743  
-{'phone': u'312-555-1212', 'description': u'Assistance'}
  756
+>>> f.cleaned_data['phone']
  757
+u'312-555-1212'
  758
+>>> f.cleaned_data['description']
  759
+u'Assistance'
744 760
 
745 761
 # FileField ###################################################################
746 762
 
24  tests/modeltests/validation/models.py
@@ -41,8 +41,8 @@ def __unicode__(self):
41 41
 23
42 42
 
43 43
 >>> p = Person(**dict(valid_params, id='foo'))
44  
->>> p.validate()
45  
-{'id': [u'This value must be an integer.']}
  44
+>>> p.validate()['id']
  45
+[u'This value must be an integer.']
46 46
 
47 47
 >>> p = Person(**dict(valid_params, id=None))
48 48
 >>> p.validate()
@@ -75,8 +75,8 @@ def __unicode__(self):
75 75
 False
76 76
 
77 77
 >>> p = Person(**dict(valid_params, is_child='foo'))
78  
->>> p.validate()
79  
-{'is_child': [u'This value must be either True or False.']}
  78
+>>> p.validate()['is_child']
  79
+[u'This value must be either True or False.']
80 80
 
81 81
 >>> p = Person(**dict(valid_params, name=u'Jose'))
82 82
 >>> p.validate()
@@ -115,8 +115,8 @@ def __unicode__(self):
115 115
 datetime.date(2000, 5, 3)
116 116
 
117 117
 >>> p = Person(**dict(valid_params, birthdate='foo'))
118  
->>> p.validate()
119  
-{'birthdate': [u'Enter a valid date in YYYY-MM-DD format.']}
  118
+>>> p.validate()['birthdate']
  119
+[u'Enter a valid date in YYYY-MM-DD format.']
120 120
 
121 121
 >>> p = Person(**dict(valid_params, favorite_moment=datetime.datetime(2002, 4, 3, 13, 23)))
122 122
 >>> p.validate()
@@ -143,11 +143,15 @@ def __unicode__(self):
143 143
 u'john@example.com'
144 144
 
145 145
 >>> p = Person(**dict(valid_params, email=22))
146  
->>> p.validate()
147  
-{'email': [u'Enter a valid e-mail address.']}
  146
+>>> p.validate()['email']
  147
+[u'Enter a valid e-mail address.']
148 148
 
149 149
 # Make sure that Date and DateTime return validation errors and don't raise Python errors.
150  
->>> Person(name='John Doe', is_child=True, email='abc@def.com').validate()
151  
-{'favorite_moment': [u'This field is required.'], 'birthdate': [u'This field is required.']}
  150
+>>> p = Person(name='John Doe', is_child=True, email='abc@def.com')
  151
+>>> errors = p.validate()
  152
+>>> errors['favorite_moment']
  153
+[u'This field is required.']
  154
+>>> errors['birthdate']
  155
+[u'This field is required.']
152 156
 
153 157
 """}
4  tests/regressiontests/forms/extra.py
@@ -252,8 +252,8 @@
252 252
 </select>
253 253
 <input type="text" name="field1_2_0" value="2007-04-25" id="id_field1_2_0" /><input type="text" name="field1_2_1" value="06:24:00" id="id_field1_2_1" /></td></tr>
254 254
 
255  
->>> f.cleaned_data
256  
-{'field1': u'some text,JP,2007-04-25 06:24:00'}
  255
+>>> f.cleaned_data['field1']
  256
+u'some text,JP,2007-04-25 06:24:00'
257 257
 
258 258
 
259 259
 # IPAddressField ##################################################################
159  tests/regressiontests/forms/forms.py
@@ -36,8 +36,8 @@
36 36
 u''
37 37
 >>> p.errors.as_text()
38 38
 u''
39  
->>> p.cleaned_data
40  
-{'first_name': u'John', 'last_name': u'Lennon', 'birthday': datetime.date(1940, 10, 9)}
  39
+>>> p.cleaned_data["first_name"], p.cleaned_data["last_name"], p.cleaned_data["birthday"]
  40
+(u'John', u'Lennon', datetime.date(1940, 10, 9))
41 41
 >>> print p['first_name']
42 42
 <input type="text" name="first_name" value="John" id="id_first_name" />
43 43
 >>> print p['last_name']
@@ -68,8 +68,12 @@
68 68
 >>> p = Person({})
69 69
 >>> p.is_bound
70 70
 True
71  
->>> p.errors
72  
-{'first_name': [u'This field is required.'], 'last_name': [u'This field is required.'], 'birthday': [u'This field is required.']}
  71
+>>> p.errors['first_name']
  72
+[u'This field is required.']
  73
+>>> p.errors['last_name']
  74
+[u'This field is required.']
  75
+>>> p.errors['birthday']
  76
+[u'This field is required.']
73 77
 >>> p.is_valid()
74 78
 False
75 79
 >>> p.cleaned_data
@@ -137,8 +141,10 @@
137 141
 u'<p><label for="id_first_name">First name:</label> <input type="text" name="first_name" value="John" id="id_first_name" /></p>\n<p><label for="id_last_name">Last name:</label> <input type="text" name="last_name" value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" id="id_last_name" /></p>\n<p><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" value="1940-10-9" id="id_birthday" /></p>'
138 142
 
139 143
 >>> p = Person({'last_name': u'Lennon'})
140  
->>> p.errors
141  
-{'first_name': [u'This field is required.'], 'birthday': [u'This field is required.']}
  144
+>>> p.errors['first_name']
  145
+[u'This field is required.']
  146
+>>> p.errors['birthday']
  147
+[u'This field is required.']
142 148
 >>> p.is_valid()
143 149
 False
144 150
 >>> p.errors.as_ul()
@@ -175,8 +181,13 @@
175 181
 >>> p = Person(data)
176 182
 >>> p.is_valid()
177 183
 True
178  
->>> p.cleaned_data
179  
-{'first_name': u'John', 'last_name': u'Lennon', 'birthday': datetime.date(1940, 10, 9)}
  184
+>>> p.cleaned_data['first_name']
  185
+u'John'
  186
+>>> p.cleaned_data['last_name']
  187
+u'Lennon'
  188
+>>> p.cleaned_data['birthday']
  189
+datetime.date(1940, 10, 9)
  190
+
180 191
 
181 192
 cleaned_data will include a key and value for *all* fields defined in the Form,
182 193
 even if the Form's data didn't include a value for fields that are not
@@ -191,8 +202,12 @@
191 202
 >>> f = OptionalPersonForm(data)
192 203
 >>> f.is_valid()
193 204
 True
194  
->>> f.cleaned_data
195  
-{'nick_name': u'', 'first_name': u'John', 'last_name': u'Lennon'}
  205
+>>> f.cleaned_data['nick_name']
  206
+u''
  207
+>>> f.cleaned_data['first_name']
  208
+u'John'
  209
+>>> f.cleaned_data['last_name']
  210
+u'Lennon'
196 211
 
197 212
 For DateFields, it's set to None.
198 213
 >>> class OptionalPersonForm(Form):
@@ -203,8 +218,12 @@
203 218
 >>> f = OptionalPersonForm(data)
204 219
 >>> f.is_valid()
205 220
 True
206  
->>> f.cleaned_data
207  
-{'birth_date': None, 'first_name': u'John', 'last_name': u'Lennon'}
  221
+>>> print f.cleaned_data['birth_date']
  222
+None
  223
+>>> f.cleaned_data['first_name']
  224
+u'John'
  225
+>>> f.cleaned_data['last_name']
  226
+u'Lennon'
208 227
 
209 228
 "auto_id" tells the Form to add an "id" attribute to each form element.
210 229
 If it's a string that contains '%s', Django will use that as a format string
@@ -549,18 +568,22 @@
549 568
 When using CheckboxSelectMultiple, the framework expects a list of input and
550 569
 returns a list of input.
551 570
 >>> f = SongForm({'name': 'Yesterday'}, auto_id=False)
552  
->>> f.errors
553  
-{'composers': [u'This field is required.']}
  571
+>>> f.errors['composers']
  572
+[u'This field is required.']
554 573
 >>> f = SongForm({'name': 'Yesterday', 'composers': ['J']}, auto_id=False)
555 574
 >>> f.errors
556 575
 {}
557  
->>> f.cleaned_data
558  
-{'composers': [u'J'], 'name': u'Yesterday'}
  576
+>>> f.cleaned_data['composers']
  577
+[u'J']
  578
+>>> f.cleaned_data['name']
  579
+u'Yesterday'
559 580
 >>> f = SongForm({'name': 'Yesterday', 'composers': ['J', 'P']}, auto_id=False)
560 581
 >>> f.errors
561 582
 {}
562  
->>> f.cleaned_data
563  
-{'composers': [u'J', u'P'], 'name': u'Yesterday'}
  583
+>>> f.cleaned_data['composers']
  584
+[u'J', u'P']
  585
+>>> f.cleaned_data['name']
  586
+u'Yesterday'
564 587
 
565 588
 Validation errors are HTML-escaped when output as HTML.
566 589
 >>> class EscapingForm(Form):
@@ -598,16 +621,24 @@
598 621
 >>> f.errors
599 622
 {}
600 623
 >>> f = UserRegistration({}, auto_id=False)
601  
->>> f.errors
602  
-{'username': [u'This field is required.'], 'password1': [u'This field is required.'], 'password2': [u'This field is required.']}
  624
+>>> f.errors['username']
  625
+[u'This field is required.']
  626
+>>> f.errors['password1']
  627
+[u'This field is required.']
  628
+>>> f.errors['password2']
  629
+[u'This field is required.']
603 630
 >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'bar'}, auto_id=False)
604  
->>> f.errors
605  
-{'password2': [u'Please make sure your passwords match.']}
  631
+>>> f.errors['password2']
  632
+[u'Please make sure your passwords match.']
606 633
 >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'foo'}, auto_id=False)
607 634
 >>> f.errors
608 635
 {}
609  
->>> f.cleaned_data
610  
-{'username': u'adrian', 'password1': u'foo', 'password2': u'foo'}
  636
+>>> f.cleaned_data['username']
  637
+u'adrian'
  638
+>>> f.cleaned_data['password1']
  639
+u'foo'
  640
+>>> f.cleaned_data['password2']
  641
+u'foo'
611 642
 
612 643
 Another way of doing multiple-field validation is by implementing the
613 644
 Form's clean() method. If you do this, any ValidationError raised by that
@@ -632,11 +663,15 @@
632 663
 <tr><th>Username:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="username" maxlength="10" /></td></tr>
633 664
 <tr><th>Password1:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="password" name="password1" /></td></tr>
634 665
 <tr><th>Password2:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="password" name="password2" /></td></tr>
635  
->>> f.errors
636  
-{'username': [u'This field is required.'], 'password1': [u'This field is required.'], 'password2': [u'This field is required.']}
  666
+>>> f.errors['username']
  667
+[u'This field is required.']
  668
+>>> f.errors['password1']
  669
+[u'This field is required.']
  670
+>>> f.errors['password2']
  671
+[u'This field is required.']
637 672
 >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'bar'}, auto_id=False)
638  
->>> f.errors
639  
-{'__all__': [u'Please make sure your passwords match.']}
  673
+>>> f.errors['__all__']
  674
+[u'Please make sure your passwords match.']
640 675
 >>> print f.as_table()
641 676
 <tr><td colspan="2"><ul class="errorlist"><li>Please make sure your passwords match.</li></ul></td></tr>
642 677
 <tr><th>Username:</th><td><input type="text" name="username" value="adrian" maxlength="10" /></td></tr>
@@ -650,8 +685,12 @@
650 685
 >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'foo'}, auto_id=False)
651 686
 >>> f.errors
652 687
 {}
653  
->>> f.cleaned_data
654  
-{'username': u'adrian', 'password1': u'foo', 'password2': u'foo'}
  688
+>>> f.cleaned_data['username']
  689
+u'adrian'
  690
+>>> f.cleaned_data['password1']
  691
+u'foo'
  692
+>>> f.cleaned_data['password2']
  693
+u'foo'
655 694
 
656 695
 # Dynamic construction ########################################################
657 696
 
@@ -1024,8 +1063,8 @@
1024 1063
 example, we don't provide a value for 'username', and the form raises a
1025 1064
 validation error rather than using the initial value for 'username'.
1026 1065
 >>> p = UserRegistration({'password': 'secret'})
1027  
->>> p.errors
1028  
-{'username': [u'This field is required.']}
  1066
+>>> p.errors['username']
  1067
+[u'This field is required.']
1029 1068
 >>> p.is_valid()
1030 1069
 False
1031 1070
 
@@ -1069,8 +1108,8 @@
1069 1108
 In this example, we don't provide a value for 'username', and the form raises a
1070 1109
 validation error rather than using the initial value for 'username'.
1071 1110
 >>> p = UserRegistration({'password': 'secret'}, initial={'username': 'django'})
1072  
->>> p.errors
1073  
-{'username': [u'This field is required.']}
  1111
+>>> p.errors['username']
  1112
+[u'This field is required.']
1074 1113
 >>> p.is_valid()
1075 1114
 False
1076 1115
 
@@ -1123,8 +1162,8 @@
1123 1162
 In this example, we don't provide a value for 'username', and the form raises a
1124 1163
 validation error rather than using the initial value for 'username'.
1125 1164
 >>> p = UserRegistration({'password': 'secret'}, initial={'username': initial_django})
1126  
->>> p.errors
1127  
-{'username': [u'This field is required.']}
  1165
+>>> p.errors['username']
  1166
+[u'This field is required.']
1128 1167
 >>> p.is_valid()
1129 1168
 False
1130 1169
 
@@ -1258,8 +1297,12 @@
1258 1297
 {}
1259 1298
 >>> p.is_valid()
1260 1299
 True
1261  
->>> p.cleaned_data
1262  
-{'first_name': u'John', 'last_name': u'Lennon', 'birthday': datetime.date(1940, 10, 9)}
  1300
+>>> p.cleaned_data['first_name']
  1301
+u'John'
  1302
+>>> p.cleaned_data['last_name']
  1303
+u'Lennon'
  1304
+>>> p.cleaned_data['birthday']
  1305
+datetime.date(1940, 10, 9)
1263 1306
 
1264 1307
 Let's try submitting some bad data to make sure form.errors and field.errors
1265 1308
 work as expected.
@@ -1269,8 +1312,12 @@
1269 1312
 ...     'person1-birthday': u''
1270 1313
 ... }
1271 1314
 >>> p = Person(data, prefix='person1')
1272  
->>> p.errors
1273  
-{'first_name': [u'This field is required.'], 'last_name': [u'This field is required.'], 'birthday': [u'This field is required.']}
  1315
+>>> p.errors['first_name']
  1316
+[u'This field is required.']
  1317
+>>> p.errors['last_name']
  1318
+[u'This field is required.']
  1319
+>>> p.errors['birthday']
  1320
+[u'This field is required.']
1274 1321
 >>> p['first_name'].errors
1275 1322
 [u'This field is required.']
1276 1323
 >>> p['person1-first_name'].errors
@@ -1286,8 +1333,12 @@
1286 1333
 ...     'birthday': u'1940-10-9'
1287 1334
 ... }
1288 1335
 >>> p = Person(data, prefix='person1')
1289  
->>> p.errors
1290  
-{'first_name': [u'This field is required.'], 'last_name': [u'This field is required.'], 'birthday': [u'This field is required.']}
  1336
+>>> p.errors['first_name']
  1337
+[u'This field is required.']
  1338
+>>> p.errors['last_name']
  1339
+[u'This field is required.']
  1340
+>>> p.errors['birthday']
  1341
+[u'This field is required.']
1291 1342
 
1292 1343
 With prefixes, a single data dictionary can hold data for multiple instances
1293 1344
 of the same form.
@@ -1302,13 +1353,21 @@
1302 1353
 >>> p1 = Person(data, prefix='person1')
1303 1354
 >>> p1.is_valid()
1304 1355
 True
1305  
->>> p1.cleaned_data
1306  
-{'first_name': u'John', 'last_name': u'Lennon', 'birthday': datetime.date(1940, 10, 9)}
  1356
+>>> p1.cleaned_data['first_name']
  1357
+u'John'
  1358
+>>> p1.cleaned_data['last_name']
  1359
+u'Lennon'
  1360
+>>> p1.cleaned_data['birthday']
  1361
+datetime.date(1940, 10, 9)
1307 1362
 >>> p2 = Person(data, prefix='person2')
1308 1363
 >>> p2.is_valid()
1309 1364
 True
1310  
->>> p2.cleaned_data
1311  
-{'first_name': u'Jim', 'last_name': u'Morrison', 'birthday': datetime.date(1943, 12, 8)}
  1365
+>>> p2.cleaned_data['first_name']
  1366
+u'Jim'
  1367
+>>> p2.cleaned_data['last_name']
  1368
+u'Morrison'
  1369
+>>> p2.cleaned_data['birthday']
  1370
+datetime.date(1943, 12, 8)
1312 1371
 
1313 1372
 By default, forms append a hyphen between the prefix and the field name, but a
1314 1373
 form can alter that behavior by implementing the add_prefix() method. This
@@ -1333,8 +1392,12 @@
1333 1392
 >>> p = Person(data, prefix='foo')
1334 1393
 >>> p.is_valid()
1335 1394
 True
1336  
->>> p.cleaned_data
1337  
-{'first_name': u'John', 'last_name': u'Lennon', 'birthday': datetime.date(1940, 10, 9)}
  1395
+>>> p.cleaned_data['first_name']
  1396
+u'John'
  1397
+>>> p.cleaned_data['last_name']
  1398
+u'Lennon'
  1399
+>>> p.cleaned_data['birthday']
  1400
+datetime.date(1940, 10, 9)
1338 1401
 
1339 1402
 # Forms with NullBooleanFields ################################################
1340 1403
 

0 notes on commit bc1f67a

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