|
896 | 896 | >>> f.clean('1234567890a') |
897 | 897 | Traceback (most recent call last): |
898 | 898 | ... |
899 | | -ValidationError: [u'Ensure this value has at most 10 characters.'] |
| 899 | +ValidationError: [u'Ensure this value has at most 10 characters (it has 11).'] |
900 | 900 |
|
901 | 901 | CharField accepts an optional min_length parameter: |
902 | 902 | >>> f = CharField(min_length=10, required=False) |
|
905 | 905 | >>> f.clean('12345') |
906 | 906 | Traceback (most recent call last): |
907 | 907 | ... |
908 | | -ValidationError: [u'Ensure this value has at least 10 characters.'] |
| 908 | +ValidationError: [u'Ensure this value has at least 10 characters (it has 5).'] |
909 | 909 | >>> f.clean('1234567890') |
910 | 910 | u'1234567890' |
911 | 911 | >>> f.clean('1234567890a') |
|
919 | 919 | >>> f.clean('12345') |
920 | 920 | Traceback (most recent call last): |
921 | 921 | ... |
922 | | -ValidationError: [u'Ensure this value has at least 10 characters.'] |
| 922 | +ValidationError: [u'Ensure this value has at least 10 characters (it has 5).'] |
923 | 923 | >>> f.clean('1234567890') |
924 | 924 | u'1234567890' |
925 | 925 | >>> f.clean('1234567890a') |
|
1443 | 1443 | >>> f.clean('123') |
1444 | 1444 | Traceback (most recent call last): |
1445 | 1445 | ... |
1446 | | -ValidationError: [u'Ensure this value has at least 5 characters.'] |
| 1446 | +ValidationError: [u'Ensure this value has at least 5 characters (it has 3).'] |
1447 | 1447 | >>> f.clean('abc') |
1448 | 1448 | Traceback (most recent call last): |
1449 | 1449 | ... |
1450 | | -ValidationError: [u'Ensure this value has at least 5 characters.'] |
| 1450 | +ValidationError: [u'Ensure this value has at least 5 characters (it has 3).'] |
1451 | 1451 | >>> f.clean('12345') |
1452 | 1452 | u'12345' |
1453 | 1453 | >>> f.clean('1234567890') |
1454 | 1454 | u'1234567890' |
1455 | 1455 | >>> f.clean('12345678901') |
1456 | 1456 | Traceback (most recent call last): |
1457 | 1457 | ... |
1458 | | -ValidationError: [u'Ensure this value has at most 10 characters.'] |
| 1458 | +ValidationError: [u'Ensure this value has at most 10 characters (it has 11).'] |
1459 | 1459 | >>> f.clean('12345a') |
1460 | 1460 | Traceback (most recent call last): |
1461 | 1461 | ... |
|
1512 | 1512 | >>> f.clean('a@foo.com') |
1513 | 1513 | Traceback (most recent call last): |
1514 | 1514 | ... |
1515 | | -ValidationError: [u'Ensure this value has at least 10 characters.'] |
| 1515 | +ValidationError: [u'Ensure this value has at least 10 characters (it has 9).'] |
1516 | 1516 | >>> f.clean('alf@foo.com') |
1517 | 1517 | u'alf@foo.com' |
1518 | 1518 | >>> f.clean('alf123456788@foo.com') |
1519 | 1519 | Traceback (most recent call last): |
1520 | 1520 | ... |
1521 | | -ValidationError: [u'Ensure this value has at most 15 characters.'] |
| 1521 | +ValidationError: [u'Ensure this value has at most 15 characters (it has 20).'] |
1522 | 1522 |
|
1523 | 1523 | # URLField ################################################################## |
1524 | 1524 |
|
|
1622 | 1622 | >>> f.clean('http://f.com') |
1623 | 1623 | Traceback (most recent call last): |
1624 | 1624 | ... |
1625 | | -ValidationError: [u'Ensure this value has at least 15 characters.'] |
| 1625 | +ValidationError: [u'Ensure this value has at least 15 characters (it has 12).'] |
1626 | 1626 | >>> f.clean('http://example.com') |
1627 | 1627 | u'http://example.com' |
1628 | 1628 | >>> f.clean('http://abcdefghijklmnopqrstuvwxyz.com') |
1629 | 1629 | Traceback (most recent call last): |
1630 | 1630 | ... |
1631 | | -ValidationError: [u'Ensure this value has at most 20 characters.'] |
| 1631 | +ValidationError: [u'Ensure this value has at most 20 characters (it has 37).'] |
1632 | 1632 |
|
1633 | 1633 | # BooleanField ################################################################ |
1634 | 1634 |
|
|
1800 | 1800 | >>> f.clean('longemailaddress@example.com') |
1801 | 1801 | Traceback (most recent call last): |
1802 | 1802 | ... |
1803 | | -ValidationError: [u'Ensure this value has at most 20 characters.'] |
| 1803 | +ValidationError: [u'Ensure this value has at most 20 characters (it has 28).'] |
1804 | 1804 | >>> f.clean('not an e-mail') |
1805 | 1805 | Traceback (most recent call last): |
1806 | 1806 | ... |
|
1820 | 1820 | >>> f.clean('longemailaddress@example.com') |
1821 | 1821 | Traceback (most recent call last): |
1822 | 1822 | ... |
1823 | | -ValidationError: [u'Ensure this value has at most 20 characters.'] |
| 1823 | +ValidationError: [u'Ensure this value has at most 20 characters (it has 28).'] |
1824 | 1824 | >>> f.clean('not an e-mail') |
1825 | 1825 | Traceback (most recent call last): |
1826 | 1826 | ... |
|
3271 | 3271 | <form action="" method="post"> |
3272 | 3272 | <table> |
3273 | 3273 | <tr><td colspan="2"><ul class="errorlist"><li>Please make sure your passwords match.</li></ul></td></tr> |
3274 | | -<tr><th>Username:</th><td><ul class="errorlist"><li>Ensure this value has at most 10 characters.</li></ul><input type="text" name="username" value="this-is-a-long-username" maxlength="10" /></td></tr> |
| 3274 | +<tr><th>Username:</th><td><ul class="errorlist"><li>Ensure this value has at most 10 characters (it has 23).</li></ul><input type="text" name="username" value="this-is-a-long-username" maxlength="10" /></td></tr> |
3275 | 3275 | <tr><th>Password1:</th><td><input type="password" name="password1" value="foo" /></td></tr> |
3276 | 3276 | <tr><th>Password2:</th><td><input type="password" name="password2" value="bar" /></td></tr> |
3277 | 3277 | </table> |
|
0 commit comments