Code

Ticket #2101: max_length.3.diff

File max_length.3.diff, 124.9 KB (added by gwilson, 7 years ago)

brought patch up to date.

Line 
1=== added file 'django/utils/maxlength.py'
2--- django/utils/maxlength.py   1970-01-01 00:00:00 +0000
3+++ django/utils/maxlength.py   2007-07-30 21:08:09 +0000
4@@ -0,0 +1,37 @@
5+"""
6+Methods and functions for legacy maxlength support.
7+"""
8+
9+def get_maxlength(self):
10+    return self.max_length
11+
12+def set_maxlength(self, value):
13+    self.max_length = value
14+
15+def legacy_maxlength(max_length, maxlength, default=None):
16+    """
17+    Provides backwards compatibilty for the legacy "maxlength" attribute.
18+    If one of max_length or maxlength is given, then that value is returned.
19+    If both are given, a TypeError is raised.
20+    If neither are given, the default value or None is returned depending on
21+    if a default value was given or not.
22+    """
23+    if max_length is not None and maxlength is not None:
24+        raise TypeError("field can not take both the max_length argument and"
25+                        " the legacy maxlength argument.")
26+    for value in [max_length, maxlength, default]:
27+        if value is not None:
28+            return value
29+
30+def legacy_maxlength_kwargs(kwargs, default=None):
31+    """
32+    Similar to legacy_maxlength, but operates on a dictionary with max_length
33+    and maxlength keys.  The resulting maximum length is stored using the key
34+    "max_length", and the "maxlength" key is removed it if exists.
35+    """
36+    kwargs['max_length'] = legacy_maxlength(kwargs.get('max_length', None),
37+                                            kwargs.get('maxlength', None),
38+                                            default)
39+    if 'maxlength' in kwargs:
40+        del kwargs['maxlength']
41+    return kwargs
42
43=== added directory 'tests/regressiontests/maxlength'
44=== added file 'tests/regressiontests/maxlength/__init__.py'
45=== added file 'tests/regressiontests/maxlength/models.py'
46=== added file 'tests/regressiontests/maxlength/tests.py'
47--- tests/regressiontests/maxlength/tests.py    1970-01-01 00:00:00 +0000
48+++ tests/regressiontests/maxlength/tests.py    2007-07-30 21:11:29 +0000
49@@ -0,0 +1,169 @@
50+# Test access to max_length while still providing full backwards compatibility
51+# with legacy maxlength attribute.
52+"""
53+# legacy_maxlength
54+
55+>>> from django.oldforms import legacy_maxlength
56+
57+>>> legacy_maxlength(None, None)
58+
59+
60+>>> legacy_maxlength(10, None)
61+10
62+
63+>>> legacy_maxlength(None, 10)
64+10
65+
66+>>> legacy_maxlength(10, 12)
67+Traceback (most recent call last):
68+...
69+TypeError: field can not take both the max_length argument and the legacy maxlength argument.
70+
71+>>> legacy_maxlength(None, None, 50)
72+50
73+
74+>>> legacy_maxlength(10, None, 50)
75+10
76+
77+>>> legacy_maxlength(None, 10, 50)
78+10
79+
80+>>> legacy_maxlength(10, 12, 50)
81+Traceback (most recent call last):
82+...
83+TypeError: field can not take both the max_length argument and the legacy maxlength argument.
84+
85+>>> legacy_maxlength(0, 10)
86+Traceback (most recent call last):
87+...
88+TypeError: field can not take both the max_length argument and the legacy maxlength argument.
89+
90+>>> legacy_maxlength(0, None, 10)
91+0
92+
93+>>> legacy_maxlength(None, 0, 10)
94+0
95+
96+#===============================================================================
97+# Fields
98+#===============================================================================
99+
100+# Set up fields
101+>>> from django.db.models import fields
102+>>> new = fields.Field(max_length=15)
103+>>> old = fields.Field(maxlength=10)
104+
105+# Ensure both max_length and legacy maxlength are not able to both be specified
106+>>> fields.Field(maxlength=10, max_length=15)
107+Traceback (most recent call last):
108+    ...
109+TypeError: field can not take both the max_length argument and the legacy maxlength argument.
110+
111+# Test max_length
112+>>> new.max_length
113+15
114+>>> old.max_length
115+10
116+
117+# Test accessing maxlength
118+>>> new.maxlength
119+15
120+>>> old.maxlength
121+10
122+
123+# Test setting maxlength
124+>>> new.maxlength += 1
125+>>> old.maxlength += 1
126+>>> new.max_length
127+16
128+>>> old.max_length
129+11
130+
131+# SlugField __init__ passes through max_length so test that too
132+>>> fields.SlugField('new', max_length=15).max_length
133+15
134+>>> fields.SlugField('empty').max_length
135+50
136+>>> fields.SlugField('old', maxlength=10).max_length
137+10
138+
139+#===============================================================================
140+# (old)forms
141+#===============================================================================
142+
143+>>> from django import oldforms
144+
145+# Test max_length attribute
146+
147+>>> oldforms.TextField('new', max_length=15).render('')
148+u'<input type="text" id="id_new" class="vTextField" name="new" size="30" value="" maxlength="15" />'
149+
150+>>> oldforms.IntegerField('new', max_length=15).render('')
151+u'<input type="text" id="id_new" class="vIntegerField" name="new" size="10" value="" maxlength="15" />'
152+
153+>>> oldforms.SmallIntegerField('new', max_length=15).render('')
154+u'<input type="text" id="id_new" class="vSmallIntegerField" name="new" size="5" value="" maxlength="15" />'
155+
156+>>> oldforms.PositiveIntegerField('new', max_length=15).render('')
157+u'<input type="text" id="id_new" class="vPositiveIntegerField" name="new" size="10" value="" maxlength="15" />'
158+
159+>>> oldforms.PositiveSmallIntegerField('new', max_length=15).render('')
160+u'<input type="text" id="id_new" class="vPositiveSmallIntegerField" name="new" size="5" value="" maxlength="15" />'
161+
162+>>> oldforms.DatetimeField('new', max_length=15).render('')
163+u'<input type="text" id="id_new" class="vDatetimeField" name="new" size="30" value="" maxlength="15" />'
164+
165+>>> oldforms.EmailField('new', max_length=15).render('')
166+u'<input type="text" id="id_new" class="vEmailField" name="new" size="50" value="" maxlength="15" />'
167+>>> oldforms.EmailField('new').render('')
168+u'<input type="text" id="id_new" class="vEmailField" name="new" size="50" value="" maxlength="75" />'
169+
170+>>> oldforms.URLField('new', max_length=15).render('')
171+u'<input type="text" id="id_new" class="vURLField" name="new" size="50" value="" maxlength="15" />'
172+>>> oldforms.URLField('new').render('')
173+u'<input type="text" id="id_new" class="vURLField" name="new" size="50" value="" maxlength="200" />'
174+
175+>>> oldforms.IPAddressField('new', max_length=15).render('')
176+u'<input type="text" id="id_new" class="vIPAddressField" name="new" size="15" value="" maxlength="15" />'
177+>>> oldforms.IPAddressField('new').render('')
178+u'<input type="text" id="id_new" class="vIPAddressField" name="new" size="15" value="" maxlength="15" />'
179+
180+>>> oldforms.CommaSeparatedIntegerField('new', max_length=15).render('')
181+u'<input type="text" id="id_new" class="vCommaSeparatedIntegerField" name="new" size="20" value="" maxlength="15" />'
182+
183+
184+# Test legacy maxlength attribute
185+
186+>>> oldforms.TextField('old', maxlength=10).render('')
187+u'<input type="text" id="id_old" class="vTextField" name="old" size="30" value="" maxlength="10" />'
188+
189+>>> oldforms.IntegerField('old', maxlength=10).render('')
190+u'<input type="text" id="id_old" class="vIntegerField" name="old" size="10" value="" maxlength="10" />'
191+
192+>>> oldforms.SmallIntegerField('old', maxlength=10).render('')
193+u'<input type="text" id="id_old" class="vSmallIntegerField" name="old" size="5" value="" maxlength="10" />'
194+
195+>>> oldforms.PositiveIntegerField('old', maxlength=10).render('')
196+u'<input type="text" id="id_old" class="vPositiveIntegerField" name="old" size="10" value="" maxlength="10" />'
197+
198+>>> oldforms.PositiveSmallIntegerField('old', maxlength=10).render('')
199+u'<input type="text" id="id_old" class="vPositiveSmallIntegerField" name="old" size="5" value="" maxlength="10" />'
200+
201+>>> oldforms.DatetimeField('old', maxlength=10).render('')
202+u'<input type="text" id="id_old" class="vDatetimeField" name="old" size="30" value="" maxlength="10" />'
203+
204+>>> oldforms.EmailField('old', maxlength=10).render('')
205+u'<input type="text" id="id_old" class="vEmailField" name="old" size="50" value="" maxlength="10" />'
206+
207+>>> oldforms.URLField('old', maxlength=10).render('')
208+u'<input type="text" id="id_old" class="vURLField" name="old" size="50" value="" maxlength="10" />'
209+
210+>>> oldforms.IPAddressField('old', maxlength=10).render('')
211+u'<input type="text" id="id_old" class="vIPAddressField" name="old" size="15" value="" maxlength="10" />'
212+
213+>>> oldforms.CommaSeparatedIntegerField('old', maxlength=10).render('')
214+u'<input type="text" id="id_old" class="vCommaSeparatedIntegerField" name="old" size="20" value="" maxlength="10" />'
215+"""
216+if __name__ == "__main__":
217+    import doctest
218+    doctest.testmod()
219
220=== modified file 'django/contrib/admin/models.py'
221--- django/contrib/admin/models.py      2007-07-04 12:11:04 +0000
222+++ django/contrib/admin/models.py      2007-07-29 01:59:39 +0000
223@@ -18,7 +18,7 @@
224     user = models.ForeignKey(User)
225     content_type = models.ForeignKey(ContentType, blank=True, null=True)
226     object_id = models.TextField(_('object id'), blank=True, null=True)
227-    object_repr = models.CharField(_('object repr'), maxlength=200)
228+    object_repr = models.CharField(_('object repr'), max_length=200)
229     action_flag = models.PositiveSmallIntegerField(_('action flag'))
230     change_message = models.TextField(_('change message'), blank=True)
231     objects = LogEntryManager()
232
233=== modified file 'django/contrib/admin/templatetags/admin_modify.py'
234--- django/contrib/admin/templatetags/admin_modify.py   2007-07-04 12:11:04 +0000
235+++ django/contrib/admin/templatetags/admin_modify.py   2007-07-29 02:01:01 +0000
236@@ -192,7 +192,7 @@
237             t.append(u'document.getElementById("id_%s").onkeyup = function() {' \
238                      ' var e = document.getElementById("id_%s");' \
239                      ' if(!e._changed) { e.value = URLify(%s, %s);} }; ' % (
240-                     f, field.name, add_values, field.maxlength))
241+                     f, field.name, add_values, field.max_length))
242     return u''.join(t)
243 auto_populated_field_script = register.simple_tag(auto_populated_field_script)
244 
245
246=== modified file 'django/contrib/admin/views/doc.py'
247--- django/contrib/admin/views/doc.py   2007-07-04 12:11:04 +0000
248+++ django/contrib/admin/views/doc.py   2007-07-29 01:59:35 +0000
249@@ -291,7 +291,7 @@
250 DATA_TYPE_MAPPING = {
251     'AutoField'                 : _('Integer'),
252     'BooleanField'              : _('Boolean (Either True or False)'),
253-    'CharField'                 : _('String (up to %(maxlength)s)'),
254+    'CharField'                 : _('String (up to %(max_length)s)'),
255     'CommaSeparatedIntegerField': _('Comma-separated integers'),
256     'DateField'                 : _('Date (without time)'),
257     'DateTimeField'             : _('Date (with time)'),
258@@ -310,7 +310,7 @@
259     'PhoneNumberField'          : _('Phone number'),
260     'PositiveIntegerField'      : _('Integer'),
261     'PositiveSmallIntegerField' : _('Integer'),
262-    'SlugField'                 : _('String (up to %(maxlength)s)'),
263+    'SlugField'                 : _('String (up to %(max_length)s)'),
264     'SmallIntegerField'         : _('Integer'),
265     'TextField'                 : _('Text'),
266     'TimeField'                 : _('Time'),
267
268=== modified file 'django/contrib/auth/forms.py'
269--- django/contrib/auth/forms.py        2007-07-04 12:11:04 +0000
270+++ django/contrib/auth/forms.py        2007-07-29 01:59:46 +0000
271@@ -10,10 +10,10 @@
272     "A form that creates a user, with no privileges, from the given username and password."
273     def __init__(self):
274         self.fields = (
275-            oldforms.TextField(field_name='username', length=30, maxlength=30, is_required=True,
276+            oldforms.TextField(field_name='username', length=30, max_length=30, is_required=True,
277                 validator_list=[validators.isAlphaNumeric, self.isValidUsername]),
278-            oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True),
279-            oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True,
280+            oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True),
281+            oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True,
282                 validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),
283         )
284 
285@@ -42,9 +42,9 @@
286         """
287         self.request = request
288         self.fields = [
289-            oldforms.TextField(field_name="username", length=15, maxlength=30, is_required=True,
290+            oldforms.TextField(field_name="username", length=15, max_length=30, is_required=True,
291                 validator_list=[self.isValidUser, self.hasCookiesEnabled]),
292-            oldforms.PasswordField(field_name="password", length=15, maxlength=30, is_required=True),
293+            oldforms.PasswordField(field_name="password", length=15, max_length=30, is_required=True),
294         ]
295         self.user_cache = None
296 
297@@ -111,11 +111,11 @@
298     def __init__(self, user):
299         self.user = user
300         self.fields = (
301-            oldforms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True,
302+            oldforms.PasswordField(field_name="old_password", length=30, max_length=30, is_required=True,
303                 validator_list=[self.isValidOldPassword]),
304-            oldforms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True,
305+            oldforms.PasswordField(field_name="new_password1", length=30, max_length=30, is_required=True,
306                 validator_list=[validators.AlwaysMatchesOtherField('new_password2', _("The two 'new password' fields didn't match."))]),
307-            oldforms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True),
308+            oldforms.PasswordField(field_name="new_password2", length=30, max_length=30, is_required=True),
309         )
310 
311     def isValidOldPassword(self, new_data, all_data):
312@@ -133,8 +133,8 @@
313     def __init__(self, user):
314         self.user = user
315         self.fields = (
316-            oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True),
317-            oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True,
318+            oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True),
319+            oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True,
320                 validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),
321         )
322 
323
324=== modified file 'django/contrib/auth/models.py'
325--- django/contrib/auth/models.py       2007-07-28 18:30:40 +0000
326+++ django/contrib/auth/models.py       2007-07-29 01:59:35 +0000
327@@ -50,9 +50,9 @@
328 
329     Three basic permissions -- add, change and delete -- are automatically created for each Django model.
330     """
331-    name = models.CharField(_('name'), maxlength=50)
332+    name = models.CharField(_('name'), max_length=50)
333     content_type = models.ForeignKey(ContentType)
334-    codename = models.CharField(_('codename'), maxlength=100)
335+    codename = models.CharField(_('codename'), max_length=100)
336 
337     class Meta:
338         verbose_name = _('permission')
339@@ -70,7 +70,7 @@
340 
341     Beyond permissions, groups are a convenient way to categorize users to apply some label, or extended functionality, to them. For example, you could create a group 'Special users', and you could write code that would do special things to those users -- such as giving them access to a members-only portion of your site, or sending them members-only e-mail messages.
342     """
343-    name = models.CharField(_('name'), maxlength=80, unique=True)
344+    name = models.CharField(_('name'), max_length=80, unique=True)
345     permissions = models.ManyToManyField(Permission, verbose_name=_('permissions'), blank=True, filter_interface=models.HORIZONTAL)
346 
347     class Meta:
348@@ -108,11 +108,11 @@
349 
350     Username and password are required. Other fields are optional.
351     """
352-    username = models.CharField(_('username'), maxlength=30, unique=True, validator_list=[validators.isAlphaNumeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."))
353-    first_name = models.CharField(_('first name'), maxlength=30, blank=True)
354-    last_name = models.CharField(_('last name'), maxlength=30, blank=True)
355+    username = models.CharField(_('username'), max_length=30, unique=True, validator_list=[validators.isAlphaNumeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."))
356+    first_name = models.CharField(_('first name'), max_length=30, blank=True)
357+    last_name = models.CharField(_('last name'), max_length=30, blank=True)
358     email = models.EmailField(_('e-mail address'), blank=True)
359-    password = models.CharField(_('password'), maxlength=128, help_text=_("Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change password form</a>."))
360+    password = models.CharField(_('password'), max_length=128, help_text=_("Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change password form</a>."))
361     is_staff = models.BooleanField(_('staff status'), default=False, help_text=_("Designates whether the user can log into this admin site."))
362     is_active = models.BooleanField(_('active'), default=True, help_text=_("Designates whether this user can log into the Django admin. Unselect this instead of deleting accounts."))
363     is_superuser = models.BooleanField(_('superuser status'), default=False, help_text=_("Designates that this user has all permissions without explicitly assigning them."))
364
365=== modified file 'django/contrib/comments/models.py'
366--- django/contrib/comments/models.py   2007-07-04 12:11:04 +0000
367+++ django/contrib/comments/models.py   2007-07-29 01:59:40 +0000
368@@ -65,8 +65,8 @@
369     user = models.ForeignKey(User, raw_id_admin=True)
370     content_type = models.ForeignKey(ContentType)
371     object_id = models.IntegerField(_('object ID'))
372-    headline = models.CharField(_('headline'), maxlength=255, blank=True)
373-    comment = models.TextField(_('comment'), maxlength=3000)
374+    headline = models.CharField(_('headline'), max_length=255, blank=True)
375+    comment = models.TextField(_('comment'), max_length=3000)
376     rating1 = models.PositiveSmallIntegerField(_('rating #1'), blank=True, null=True)
377     rating2 = models.PositiveSmallIntegerField(_('rating #2'), blank=True, null=True)
378     rating3 = models.PositiveSmallIntegerField(_('rating #3'), blank=True, null=True)
379@@ -164,8 +164,8 @@
380     # A FreeComment is a comment by a non-registered user.
381     content_type = models.ForeignKey(ContentType)
382     object_id = models.IntegerField(_('object ID'))
383-    comment = models.TextField(_('comment'), maxlength=3000)
384-    person_name = models.CharField(_("person's name"), maxlength=50)
385+    comment = models.TextField(_('comment'), max_length=3000)
386+    person_name = models.CharField(_("person's name"), max_length=50)
387     submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True)
388     is_public = models.BooleanField(_('is public'))
389     ip_address = models.IPAddressField(_('ip address'))
390
391=== modified file 'django/contrib/comments/views/comments.py'
392--- django/contrib/comments/views/comments.py   2007-07-04 12:11:04 +0000
393+++ django/contrib/comments/views/comments.py   2007-07-29 01:59:35 +0000
394@@ -29,7 +29,7 @@
395             else:
396                 return []
397         self.fields.extend([
398-            oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True,
399+            oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True,
400                 validator_list=[self.hasNoProfanities]),
401             oldforms.RadioSelectField(field_name="rating1", choices=choices,
402                 is_required=ratings_required and num_rating_choices > 0,
403@@ -122,9 +122,9 @@
404     "Manipulator that handles public free (unregistered) comments"
405     def __init__(self):
406         self.fields = (
407-            oldforms.TextField(field_name="person_name", maxlength=50, is_required=True,
408+            oldforms.TextField(field_name="person_name", max_length=50, is_required=True,
409                 validator_list=[self.hasNoProfanities]),
410-            oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True,
411+            oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True,
412                 validator_list=[self.hasNoProfanities]),
413         )
414 
415
416=== modified file 'django/contrib/contenttypes/models.py'
417--- django/contrib/contenttypes/models.py       2007-07-04 12:11:04 +0000
418+++ django/contrib/contenttypes/models.py       2007-07-29 01:59:40 +0000
419@@ -32,9 +32,9 @@
420         CONTENT_TYPE_CACHE = {}
421 
422 class ContentType(models.Model):
423-    name = models.CharField(maxlength=100)
424-    app_label = models.CharField(maxlength=100)
425-    model = models.CharField(_('python model class name'), maxlength=100)
426+    name = models.CharField(max_length=100)
427+    app_label = models.CharField(max_length=100)
428+    model = models.CharField(_('python model class name'), max_length=100)
429     objects = ContentTypeManager()
430     class Meta:
431         verbose_name = _('content type')
432
433=== modified file 'django/contrib/flatpages/models.py'
434--- django/contrib/flatpages/models.py  2007-07-04 12:11:04 +0000
435+++ django/contrib/flatpages/models.py  2007-07-29 01:59:40 +0000
436@@ -4,12 +4,12 @@
437 from django.utils.translation import ugettext_lazy as _
438 
439 class FlatPage(models.Model):
440-    url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL], db_index=True,
441+    url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True,
442         help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes."))
443-    title = models.CharField(_('title'), maxlength=200)
444+    title = models.CharField(_('title'), max_length=200)
445     content = models.TextField(_('content'))
446     enable_comments = models.BooleanField(_('enable comments'))
447-    template_name = models.CharField(_('template name'), maxlength=70, blank=True,
448+    template_name = models.CharField(_('template name'), max_length=70, blank=True,
449         help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'."))
450     registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page."))
451     sites = models.ManyToManyField(Site)
452
453=== modified file 'django/contrib/redirects/models.py'
454--- django/contrib/redirects/models.py  2007-07-04 12:11:04 +0000
455+++ django/contrib/redirects/models.py  2007-07-29 01:59:40 +0000
456@@ -4,9 +4,9 @@
457 
458 class Redirect(models.Model):
459     site = models.ForeignKey(Site, radio_admin=models.VERTICAL)
460-    old_path = models.CharField(_('redirect from'), maxlength=200, db_index=True,
461+    old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
462         help_text=_("This should be an absolute path, excluding the domain name. Example: '/events/search/'."))
463-    new_path = models.CharField(_('redirect to'), maxlength=200, blank=True,
464+    new_path = models.CharField(_('redirect to'), max_length=200, blank=True,
465         help_text=_("This can be either an absolute path (as above) or a full URL starting with 'http://'."))
466 
467     class Meta:
468
469=== modified file 'django/contrib/sessions/models.py'
470--- django/contrib/sessions/models.py   2007-07-04 12:11:04 +0000
471+++ django/contrib/sessions/models.py   2007-07-29 01:59:35 +0000
472@@ -65,7 +65,7 @@
473     the sessions documentation that is shipped with Django (also available
474     on the Django website).
475     """
476-    session_key = models.CharField(_('session key'), maxlength=40, primary_key=True)
477+    session_key = models.CharField(_('session key'), max_length=40, primary_key=True)
478     session_data = models.TextField(_('session data'))
479     expire_date = models.DateTimeField(_('expire date'))
480     objects = SessionManager()
481
482=== modified file 'django/contrib/sites/models.py'
483--- django/contrib/sites/models.py      2007-07-12 05:28:04 +0000
484+++ django/contrib/sites/models.py      2007-07-29 01:59:35 +0000
485@@ -12,8 +12,8 @@
486         return self.get(pk=sid)
487 
488 class Site(models.Model):
489-    domain = models.CharField(_('domain name'), maxlength=100)
490-    name = models.CharField(_('display name'), maxlength=50)
491+    domain = models.CharField(_('domain name'), max_length=100)
492+    name = models.CharField(_('display name'), max_length=50)
493     objects = SiteManager()
494     class Meta:
495         db_table = 'django_site'
496
497=== modified file 'django/core/management.py'
498--- django/core/management.py   2007-07-28 04:02:52 +0000
499+++ django/core/management.py   2007-07-29 02:00:04 +0000
500@@ -910,9 +910,9 @@
501                     field_type, new_params = field_type
502                     extra_params.update(new_params)
503 
504-                # Add maxlength for all CharFields.
505+                # Add max_length for all CharFields.
506                 if field_type == 'CharField' and row[3]:
507-                    extra_params['maxlength'] = row[3]
508+                    extra_params['max_length'] = row[3]
509 
510                 if field_type == 'DecimalField':
511                     extra_params['max_digits'] = row[4]
512@@ -987,8 +987,8 @@
513         for f in opts.fields:
514             if f.name == 'id' and not f.primary_key and opts.pk.name == 'id':
515                 e.add(opts, '"%s": You can\'t use "id" as a field name, because each model automatically gets an "id" field if none of the fields have primary_key=True. You need to either remove/rename your "id" field or add primary_key=True to a field.' % f.name)
516-            if isinstance(f, models.CharField) and f.maxlength in (None, 0):
517-                e.add(opts, '"%s": CharFields require a "maxlength" attribute.' % f.name)
518+            if isinstance(f, models.CharField) and f.max_length in (None, 0):
519+                e.add(opts, '"%s": CharFields require a "max_length" attribute.' % f.name)
520             if isinstance(f, models.DecimalField):
521                 if f.decimal_places is None:
522                     e.add(opts, '"%s": DecimalFields require a "decimal_places" attribute.' % f.name)
523@@ -1013,11 +1013,11 @@
524             if f.db_index not in (None, True, False):
525                 e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name)
526 
527-            # Check that maxlength <= 255 if using older MySQL versions.
528+            # Check that max_length <= 255 if using older MySQL versions.
529             if settings.DATABASE_ENGINE == 'mysql':
530                 db_version = connection.get_server_version()
531-                if db_version < (5, 0, 3) and isinstance(f, (models.CharField, models.CommaSeparatedIntegerField, models.SlugField)) and f.maxlength > 255:
532-                    e.add(opts, '"%s": %s cannot have a "maxlength" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %s).' % (f.name, f.__class__.__name__, '.'.join([str(n) for n in db_version[:3]])))
533+                if db_version < (5, 0, 3) and isinstance(f, (models.CharField, models.CommaSeparatedIntegerField, models.SlugField)) and f.max_length > 255:
534+                    e.add(opts, '"%s": %s cannot have a "max_length" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %s).' % (f.name, f.__class__.__name__, '.'.join([str(n) for n in db_version[:3]])))
535 
536             # Check to see if the related field will clash with any
537             # existing fields, m2m fields, m2m related objects or related objects
538@@ -1252,7 +1252,7 @@
539     from django.db import backend, connection, transaction, models
540     fields = (
541         # "key" is a reserved word in MySQL, so use "cache_key" instead.
542-        models.CharField(name='cache_key', maxlength=255, unique=True, primary_key=True),
543+        models.CharField(name='cache_key', max_length=255, unique=True, primary_key=True),
544         models.TextField(name='value'),
545         models.DateTimeField(name='expires', db_index=True),
546     )
547
548=== modified file 'django/db/backends/ado_mssql/creation.py'
549--- django/db/backends/ado_mssql/creation.py    2007-07-20 06:28:56 +0000
550+++ django/db/backends/ado_mssql/creation.py    2007-07-29 01:59:34 +0000
551@@ -1,8 +1,8 @@
552 DATA_TYPES = {
553     'AutoField':         'int IDENTITY (1, 1)',
554     'BooleanField':      'bit',
555-    'CharField':         'varchar(%(maxlength)s)',
556-    'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
557+    'CharField':         'varchar(%(max_length)s)',
558+    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
559     'DateField':         'smalldatetime',
560     'DateTimeField':     'smalldatetime',
561     'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
562@@ -17,7 +17,7 @@
563     'PhoneNumberField':  'varchar(20)',
564     'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)',
565     'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] > 0)',
566-    'SlugField':         'varchar(%(maxlength)s)',
567+    'SlugField':         'varchar(%(max_length)s)',
568     'SmallIntegerField': 'smallint',
569     'TextField':         'text',
570     'TimeField':         'time',
571
572=== modified file 'django/db/backends/mysql/creation.py'
573--- django/db/backends/mysql/creation.py        2007-07-20 06:28:56 +0000
574+++ django/db/backends/mysql/creation.py        2007-07-29 01:59:56 +0000
575@@ -5,8 +5,8 @@
576 DATA_TYPES = {
577     'AutoField':         'integer AUTO_INCREMENT',
578     'BooleanField':      'bool',
579-    'CharField':         'varchar(%(maxlength)s)',
580-    'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
581+    'CharField':         'varchar(%(max_length)s)',
582+    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
583     'DateField':         'date',
584     'DateTimeField':     'datetime',
585     'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
586@@ -21,7 +21,7 @@
587     'PhoneNumberField':  'varchar(20)',
588     'PositiveIntegerField': 'integer UNSIGNED',
589     'PositiveSmallIntegerField': 'smallint UNSIGNED',
590-    'SlugField':         'varchar(%(maxlength)s)',
591+    'SlugField':         'varchar(%(max_length)s)',
592     'SmallIntegerField': 'smallint',
593     'TextField':         'longtext',
594     'TimeField':         'time',
595
596=== modified file 'django/db/backends/mysql_old/creation.py'
597--- django/db/backends/mysql_old/creation.py    2007-07-20 06:28:56 +0000
598+++ django/db/backends/mysql_old/creation.py    2007-07-29 19:59:52 +0000
599@@ -5,8 +5,8 @@
600 DATA_TYPES = {
601     'AutoField':         'integer AUTO_INCREMENT',
602     'BooleanField':      'bool',
603-    'CharField':         'varchar(%(maxlength)s)',
604-    'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
605+    'CharField':         'varchar(%(max_length)s)',
606+    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
607     'DateField':         'date',
608     'DateTimeField':     'datetime',
609     'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
610@@ -21,7 +21,7 @@
611     'PhoneNumberField':  'varchar(20)',
612     'PositiveIntegerField': 'integer UNSIGNED',
613     'PositiveSmallIntegerField': 'smallint UNSIGNED',
614-    'SlugField':         'varchar(%(maxlength)s)',
615+    'SlugField':         'varchar(%(max_length)s)',
616     'SmallIntegerField': 'smallint',
617     'TextField':         'longtext',
618     'TimeField':         'time',
619
620=== modified file 'django/db/backends/oracle/creation.py'
621--- django/db/backends/oracle/creation.py       2007-07-20 06:28:56 +0000
622+++ django/db/backends/oracle/creation.py       2007-07-29 02:01:35 +0000
623@@ -8,8 +8,8 @@
624 DATA_TYPES = {
625     'AutoField':                    'NUMBER(11)',
626     'BooleanField':                 'NUMBER(1) CHECK (%(column)s IN (0,1))',
627-    'CharField':                    'NVARCHAR2(%(maxlength)s)',
628-    'CommaSeparatedIntegerField':   'VARCHAR2(%(maxlength)s)',
629+    'CharField':                    'NVARCHAR2(%(max_length)s)',
630+    'CommaSeparatedIntegerField':   'VARCHAR2(%(max_length)s)',
631     'DateField':                    'DATE',
632     'DateTimeField':                'TIMESTAMP',
633     'DecimalField':                 'NUMBER(%(max_digits)s, %(decimal_places)s)',
634
635=== modified file 'django/db/backends/postgresql/creation.py'
636--- django/db/backends/postgresql/creation.py   2007-07-20 06:28:56 +0000
637+++ django/db/backends/postgresql/creation.py   2007-07-29 01:59:51 +0000
638@@ -5,8 +5,8 @@
639 DATA_TYPES = {
640     'AutoField':         'serial',
641     'BooleanField':      'boolean',
642-    'CharField':         'varchar(%(maxlength)s)',
643-    'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
644+    'CharField':         'varchar(%(max_length)s)',
645+    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
646     'DateField':         'date',
647     'DateTimeField':     'timestamp with time zone',
648     'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
649@@ -21,7 +21,7 @@
650     'PhoneNumberField':  'varchar(20)',
651     'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
652     'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
653-    'SlugField':         'varchar(%(maxlength)s)',
654+    'SlugField':         'varchar(%(max_length)s)',
655     'SmallIntegerField': 'smallint',
656     'TextField':         'text',
657     'TimeField':         'time',
658
659=== modified file 'django/db/backends/sqlite3/creation.py'
660--- django/db/backends/sqlite3/creation.py      2007-07-20 06:28:56 +0000
661+++ django/db/backends/sqlite3/creation.py      2007-07-29 02:00:03 +0000
662@@ -4,8 +4,8 @@
663 DATA_TYPES = {
664     'AutoField':                    'integer',
665     'BooleanField':                 'bool',
666-    'CharField':                    'varchar(%(maxlength)s)',
667-    'CommaSeparatedIntegerField':   'varchar(%(maxlength)s)',
668+    'CharField':                    'varchar(%(max_length)s)',
669+    'CommaSeparatedIntegerField':   'varchar(%(max_length)s)',
670     'DateField':                    'date',
671     'DateTimeField':                'datetime',
672     'DecimalField':                 'decimal',
673@@ -20,7 +20,7 @@
674     'PhoneNumberField':             'varchar(20)',
675     'PositiveIntegerField':         'integer unsigned',
676     'PositiveSmallIntegerField':    'smallint unsigned',
677-    'SlugField':                    'varchar(%(maxlength)s)',
678+    'SlugField':                    'varchar(%(max_length)s)',
679     'SmallIntegerField':            'smallint',
680     'TextField':                    'text',
681     'TimeField':                    'time',
682
683=== modified file 'django/db/backends/sqlite3/introspection.py'
684--- django/db/backends/sqlite3/introspection.py 2006-07-21 17:11:13 +0000
685+++ django/db/backends/sqlite3/introspection.py 2007-07-29 01:23:45 +0000
686@@ -81,7 +81,7 @@
687             import re
688             m = re.search(r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$', key)
689             if m:
690-                return ('CharField', {'maxlength': int(m.group(1))})
691+                return ('CharField', {'max_length': int(m.group(1))})
692             raise KeyError
693 
694 DATA_TYPES_REVERSE = FlexibleFieldLookupDict()
695
696=== modified file 'django/db/models/fields/__init__.py'
697--- django/db/models/fields/__init__.py 2007-07-30 17:25:35 +0000
698+++ django/db/models/fields/__init__.py 2007-07-30 21:03:59 +0000
699@@ -11,6 +11,7 @@
700 from django.utils.text import capfirst
701 from django.utils.translation import ugettext_lazy, ugettext as _
702 from django.utils.encoding import smart_unicode, force_unicode, smart_str
703+from django.utils.maxlength import get_maxlength, set_maxlength, legacy_maxlength, legacy_maxlength_kwargs
704 import datetime, os, time
705 try:
706     import decimal
707@@ -72,15 +73,19 @@
708     creation_counter = 0
709 
710     def __init__(self, verbose_name=None, name=None, primary_key=False,
711-        maxlength=None, unique=False, blank=False, null=False, db_index=False,
712+        max_length=None, unique=False, blank=False, null=False, db_index=False,
713         core=False, rel=None, default=NOT_PROVIDED, editable=True, serialize=True,
714         prepopulate_from=None, unique_for_date=None, unique_for_month=None,
715         unique_for_year=None, validator_list=None, choices=None, radio_admin=None,
716-        help_text='', db_column=None, db_tablespace=None):
717+        help_text='', db_column=None, db_tablespace=None, maxlength=None):
718         self.name = name
719         self.verbose_name = verbose_name
720         self.primary_key = primary_key
721-        self.maxlength, self.unique = maxlength, unique
722+        # Fields now use max_length, but still support the legacy
723+        # maxlength argument.
724+        self.max_length = legacy_maxlength(max_length=max_length,
725+                                           maxlength=maxlength)
726+        self.unique = unique
727         self.blank, self.null = blank, null
728         # Oracle treats the empty string ('') as null, so coerce the null
729         # option whenever '' is a possible value.
730@@ -106,6 +111,9 @@
731         self.creation_counter = Field.creation_counter
732         Field.creation_counter += 1
733 
734+    # Support accessing and setting to the legacy maxlength argument.
735+    maxlength = property(get_maxlength, set_maxlength)
736+
737     def __cmp__(self, other):
738         # This is needed because bisect does not take a comparison function.
739         return cmp(self.creation_counter, other.creation_counter)
740@@ -244,8 +252,8 @@
741 
742     def prepare_field_objs_and_params(self, manipulator, name_prefix):
743         params = {'validator_list': self.validator_list[:]}
744-        if self.maxlength and not self.choices: # Don't give SelectFields a maxlength parameter.
745-            params['maxlength'] = self.maxlength
746+        if self.max_length and not self.choices: # Don't give SelectFields a max_length parameter.
747+            params['max_length'] = self.max_length
748 
749         if self.choices:
750             if self.radio_admin:
751@@ -461,7 +469,7 @@
752         return smart_unicode(value)
753 
754     def formfield(self, **kwargs):
755-        defaults = {'max_length': self.maxlength}
756+        defaults = {'max_length': self.max_length}
757         defaults.update(kwargs)
758         return super(CharField, self).formfield(**defaults)
759 
760@@ -670,7 +678,8 @@
761 
762 class EmailField(CharField):
763     def __init__(self, *args, **kwargs):
764-        kwargs['maxlength'] = 75
765+        kwargs = legacy_maxlength_kwargs(kwargs)
766+        kwargs['max_length'] = 75
767         CharField.__init__(self, *args, **kwargs)
768 
769     def get_internal_type(self):
770@@ -829,7 +838,8 @@
771 class IPAddressField(Field):
772     empty_strings_allowed = False
773     def __init__(self, *args, **kwargs):
774-        kwargs['maxlength'] = 15
775+        kwargs = legacy_maxlength_kwargs(kwargs)
776+        kwargs['max_length'] = 15
777         Field.__init__(self, *args, **kwargs)
778 
779     def get_manipulator_field_objs(self):
780@@ -877,7 +887,7 @@
781 
782 class SlugField(Field):
783     def __init__(self, *args, **kwargs):
784-        kwargs['maxlength'] = kwargs.get('maxlength', 50)
785+        kwargs = legacy_maxlength_kwargs(kwargs, default=50)
786         kwargs.setdefault('validator_list', []).append(validators.isSlug)
787         # Set db_index=True unless it's been set manually.
788         if 'db_index' not in kwargs:
789@@ -963,7 +973,7 @@
790 
791 class URLField(CharField):
792     def __init__(self, verbose_name=None, name=None, verify_exists=True, **kwargs):
793-        kwargs['maxlength'] = kwargs.get('maxlength', 200)
794+        kwargs = legacy_maxlength_kwargs(kwargs, default=200)
795         if verify_exists:
796             kwargs.setdefault('validator_list', []).append(validators.isExistingURL)
797         self.verify_exists = verify_exists
798
799=== modified file 'django/newforms/fields.py'
800--- django/newforms/fields.py   2007-07-14 13:39:41 +0000
801+++ django/newforms/fields.py   2007-07-29 02:00:12 +0000
802@@ -120,6 +120,7 @@
803 
804     def widget_attrs(self, widget):
805         if self.max_length is not None and isinstance(widget, (TextInput, PasswordInput)):
806+            # The HTML attribute is maxlength, not max_length.
807             return {'maxlength': str(self.max_length)}
808 
809 class IntegerField(Field):
810
811=== modified file 'django/oldforms/__init__.py'
812--- django/oldforms/__init__.py 2007-07-10 12:03:36 +0000
813+++ django/oldforms/__init__.py 2007-07-30 21:17:00 +0000
814@@ -4,6 +4,7 @@
815 from django.conf import settings
816 from django.utils.translation import ugettext, ungettext
817 from django.utils.encoding import smart_unicode, force_unicode
818+from django.utils.maxlength import get_maxlength, set_maxlength, legacy_maxlength, legacy_maxlength_kwargs
819 
820 FORM_FIELD_ID_PREFIX = 'id_'
821 
822@@ -390,19 +391,27 @@
823 
824 class TextField(FormField):
825     input_type = "text"
826-    def __init__(self, field_name, length=30, maxlength=None, is_required=False, validator_list=None, member_name=None):
827+    def __init__(self, field_name, length=30, max_length=None,
828+                 is_required=False, validator_list=None, member_name=None,
829+                 maxlength=None):
830         if validator_list is None: validator_list = []
831         self.field_name = field_name
832-        self.length, self.maxlength = length, maxlength
833+        self.length = length
834+        # Fields now use max_length, but still support the legacy
835+        # maxlength argument.
836+        self.max_length = legacy_maxlength(max_length, maxlength)
837         self.is_required = is_required
838         self.validator_list = [self.isValidLength, self.hasNoNewlines] + validator_list
839         if member_name != None:
840             self.member_name = member_name
841 
842+    # Support accessing and setting the legacy maxlength argument.
843+    maxlength = property(get_maxlength, set_maxlength)
844+
845     def isValidLength(self, data, form):
846-        if data and self.maxlength and len(smart_unicode(data)) > self.maxlength:
847+        if data and self.max_length and len(smart_unicode(data)) > self.max_length:
848             raise validators.ValidationError, ungettext("Ensure your text is less than %s character.",
849-                "Ensure your text is less than %s characters.", self.maxlength) % self.maxlength
850+                "Ensure your text is less than %s characters.", self.max_length) % self.max_length
851 
852     def hasNoNewlines(self, data, form):
853         if data and '\n' in data:
854@@ -411,12 +420,12 @@
855     def render(self, data):
856         if data is None:
857             data = u''
858-        maxlength = u''
859-        if self.maxlength:
860-            maxlength = u'maxlength="%s" ' % self.maxlength
861+        max_length = u''
862+        if self.max_length:
863+            max_length = u'maxlength="%s" ' % self.max_length
864         return u'<input type="%s" id="%s" class="v%s%s" name="%s" size="%s" value="%s" %s/>' % \
865             (self.input_type, self.get_id(), self.__class__.__name__, self.is_required and u' required' or '',
866-            self.field_name, self.length, escape(data), maxlength)
867+            self.field_name, self.length, escape(data), max_length)
868 
869     def html2python(data):
870         return data
871@@ -426,14 +435,16 @@
872     input_type = "password"
873 
874 class LargeTextField(TextField):
875-    def __init__(self, field_name, rows=10, cols=40, is_required=False, validator_list=None, maxlength=None):
876+    def __init__(self, field_name, rows=10, cols=40, is_required=False,
877+                 validator_list=None, max_length=None, maxlength=None):
878+        max_length = legacy_maxlength(max_length, maxlength)
879         if validator_list is None: validator_list = []
880         self.field_name = field_name
881         self.rows, self.cols, self.is_required = rows, cols, is_required
882         self.validator_list = validator_list[:]
883-        if maxlength:
884+        if max_length:
885             self.validator_list.append(self.isValidLength)
886-            self.maxlength = maxlength
887+            self.max_length = max_length
888 
889     def render(self, data):
890         if data is None:
891@@ -710,12 +721,15 @@
892 ####################
893 
894 class IntegerField(TextField):
895-    def __init__(self, field_name, length=10, maxlength=None, is_required=False, validator_list=None, member_name=None):
896+    def __init__(self, field_name, length=10, max_length=None,
897+                 is_required=False, validator_list=None, member_name=None,
898+                 maxlength=None):
899+        max_length = legacy_maxlength(max_length, maxlength)
900         if validator_list is None: validator_list = []
901         validator_list = [self.isInteger] + validator_list
902         if member_name is not None:
903             self.member_name = member_name
904-        TextField.__init__(self, field_name, length, maxlength, is_required, validator_list)
905+        TextField.__init__(self, field_name, length, max_length, is_required, validator_list)
906 
907     def isInteger(self, field_data, all_data):
908         try:
909@@ -730,30 +744,36 @@
910     html2python = staticmethod(html2python)
911 
912 class SmallIntegerField(IntegerField):
913-    def __init__(self, field_name, length=5, maxlength=5, is_required=False, validator_list=None):
914+    def __init__(self, field_name, length=5, max_length=None,
915+                 is_required=False, validator_list=None, maxlength=None):
916+        max_length = legacy_maxlength(max_length, maxlength, 5)
917         if validator_list is None: validator_list = []
918         validator_list = [self.isSmallInteger] + validator_list
919-        IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
920+        IntegerField.__init__(self, field_name, length, max_length, is_required, validator_list)
921 
922     def isSmallInteger(self, field_data, all_data):
923         if not -32768 <= int(field_data) <= 32767:
924             raise validators.CriticalValidationError, ugettext("Enter a whole number between -32,768 and 32,767.")
925 
926 class PositiveIntegerField(IntegerField):
927-    def __init__(self, field_name, length=10, maxlength=None, is_required=False, validator_list=None):
928+    def __init__(self, field_name, length=10, max_length=None,
929+                 is_required=False, validator_list=None, maxlength=None):
930+        max_length = legacy_maxlength(max_length, maxlength)
931         if validator_list is None: validator_list = []
932         validator_list = [self.isPositive] + validator_list
933-        IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
934+        IntegerField.__init__(self, field_name, length, max_length, is_required, validator_list)
935 
936     def isPositive(self, field_data, all_data):
937         if int(field_data) < 0:
938             raise validators.CriticalValidationError, ugettext("Enter a positive number.")
939 
940 class PositiveSmallIntegerField(IntegerField):
941-    def __init__(self, field_name, length=5, maxlength=None, is_required=False, validator_list=None):
942+    def __init__(self, field_name, length=5, max_length=None,
943+                 is_required=False, validator_list=None, maxlength=None):
944+        max_length = legacy_maxlength(max_length, maxlength)
945         if validator_list is None: validator_list = []
946         validator_list = [self.isPositiveSmall] + validator_list
947-        IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
948+        IntegerField.__init__(self, field_name, length, max_length, is_required, validator_list)
949 
950     def isPositiveSmall(self, field_data, all_data):
951         if not 0 <= int(field_data) <= 32767:
952@@ -806,10 +826,12 @@
953 class DatetimeField(TextField):
954     """A FormField that automatically converts its data to a datetime.datetime object.
955     The data should be in the format YYYY-MM-DD HH:MM:SS."""
956-    def __init__(self, field_name, length=30, maxlength=None, is_required=False, validator_list=None):
957+    def __init__(self, field_name, length=30, max_length=None,
958+                 is_required=False, validator_list=None, maxlength=None):
959+        max_length = legacy_maxlength(max_length, maxlength)
960         if validator_list is None: validator_list = []
961         self.field_name = field_name
962-        self.length, self.maxlength = length, maxlength
963+        self.length, self.max_length = length, max_length
964         self.is_required = is_required
965         self.validator_list = [validators.isValidANSIDatetime] + validator_list
966 
967@@ -836,7 +858,7 @@
968     def __init__(self, field_name, is_required=False, validator_list=None):
969         if validator_list is None: validator_list = []
970         validator_list = [self.isValidDate] + validator_list
971-        TextField.__init__(self, field_name, length=10, maxlength=10,
972+        TextField.__init__(self, field_name, length=10, max_length=10,
973             is_required=is_required, validator_list=validator_list)
974 
975     def isValidDate(self, field_data, all_data):
976@@ -861,7 +883,7 @@
977     def __init__(self, field_name, is_required=False, validator_list=None):
978         if validator_list is None: validator_list = []
979         validator_list = [self.isValidTime] + validator_list
980-        TextField.__init__(self, field_name, length=8, maxlength=8,
981+        TextField.__init__(self, field_name, length=8, max_length=8,
982             is_required=is_required, validator_list=validator_list)
983 
984     def isValidTime(self, field_data, all_data):
985@@ -893,10 +915,12 @@
986 
987 class EmailField(TextField):
988     "A convenience FormField for validating e-mail addresses"
989-    def __init__(self, field_name, length=50, maxlength=75, is_required=False, validator_list=None):
990+    def __init__(self, field_name, length=50, max_length=None,
991+                 is_required=False, validator_list=None, maxlength=None):
992+        max_length = legacy_maxlength(max_length, maxlength, 75)
993         if validator_list is None: validator_list = []
994         validator_list = [self.isValidEmail] + validator_list
995-        TextField.__init__(self, field_name, length, maxlength=maxlength,
996+        TextField.__init__(self, field_name, length, max_length=max_length,
997             is_required=is_required, validator_list=validator_list)
998 
999     def isValidEmail(self, field_data, all_data):
1000@@ -907,10 +931,12 @@
1001 
1002 class URLField(TextField):
1003     "A convenience FormField for validating URLs"
1004-    def __init__(self, field_name, length=50, maxlength=200, is_required=False, validator_list=None):
1005+    def __init__(self, field_name, length=50, max_length=None,
1006+                 is_required=False, validator_list=None, maxlength=None):
1007+        max_length = legacy_maxlength(max_length, maxlength, 200)
1008         if validator_list is None: validator_list = []
1009         validator_list = [self.isValidURL] + validator_list
1010-        TextField.__init__(self, field_name, length=length, maxlength=maxlength,
1011+        TextField.__init__(self, field_name, length=length, max_length=max_length,
1012             is_required=is_required, validator_list=validator_list)
1013 
1014     def isValidURL(self, field_data, all_data):
1015@@ -920,10 +946,12 @@
1016             raise validators.CriticalValidationError, e.messages
1017 
1018 class IPAddressField(TextField):
1019-    def __init__(self, field_name, length=15, maxlength=15, is_required=False, validator_list=None):
1020+    def __init__(self, field_name, length=15, max_length=None,
1021+                 is_required=False, validator_list=None, maxlength=None):
1022+        max_length = legacy_maxlength(max_length, maxlength, 15)
1023         if validator_list is None: validator_list = []
1024         validator_list = [self.isValidIPAddress] + validator_list
1025-        TextField.__init__(self, field_name, length=length, maxlength=maxlength,
1026+        TextField.__init__(self, field_name, length=length, max_length=max_length,
1027             is_required=is_required, validator_list=validator_list)
1028 
1029     def isValidIPAddress(self, field_data, all_data):
1030@@ -970,7 +998,7 @@
1031     def __init__(self, field_name, is_required=False, validator_list=None):
1032         if validator_list is None: validator_list = []
1033         validator_list = [self.isValidPhone] + validator_list
1034-        TextField.__init__(self, field_name, length=12, maxlength=12,
1035+        TextField.__init__(self, field_name, length=12, max_length=12,
1036             is_required=is_required, validator_list=validator_list)
1037 
1038     def isValidPhone(self, field_data, all_data):
1039@@ -984,7 +1012,7 @@
1040     def __init__(self, field_name, is_required=False, validator_list=None):
1041         if validator_list is None: validator_list = []
1042         validator_list = [self.isValidUSState] + validator_list
1043-        TextField.__init__(self, field_name, length=2, maxlength=2,
1044+        TextField.__init__(self, field_name, length=2, max_length=2,
1045             is_required=is_required, validator_list=validator_list)
1046 
1047     def isValidUSState(self, field_data, all_data):
1048@@ -1001,10 +1029,12 @@
1049 
1050 class CommaSeparatedIntegerField(TextField):
1051     "A convenience FormField for validating comma-separated integer fields"
1052-    def __init__(self, field_name, maxlength=None, is_required=False, validator_list=None):
1053+    def __init__(self, field_name, max_length=None, is_required=False,
1054+                 validator_list=None, maxlength=None):
1055+        max_length = legacy_maxlength(max_length, maxlength)
1056         if validator_list is None: validator_list = []
1057         validator_list = [self.isCommaSeparatedIntegerList] + validator_list
1058-        TextField.__init__(self, field_name, length=20, maxlength=maxlength,
1059+        TextField.__init__(self, field_name, length=20, max_length=max_length,
1060             is_required=is_required, validator_list=validator_list)
1061 
1062     def isCommaSeparatedIntegerList(self, field_data, all_data):
1063
1064=== modified file 'docs/contributing.txt'
1065--- docs/contributing.txt       2007-07-26 17:16:34 +0000
1066+++ docs/contributing.txt       2007-07-29 20:04:04 +0000
1067@@ -340,14 +340,14 @@
1068       Do this::
1069 
1070           class Person(models.Model):
1071-              first_name = models.CharField(maxlength=20)
1072-              last_name = models.CharField(maxlength=40)
1073+              first_name = models.CharField(max_length=20)
1074+              last_name = models.CharField(max_length=40)
1075 
1076       Don't do this::
1077 
1078           class Person(models.Model):
1079-              FirstName = models.CharField(maxlength=20)
1080-              Last_Name = models.CharField(maxlength=40)
1081+              FirstName = models.CharField(max_length=20)
1082+              Last_Name = models.CharField(max_length=40)
1083 
1084     * The ``class Meta`` should appear *after* the fields are defined, with
1085       a single blank line separating the fields and the class definition.
1086@@ -355,8 +355,8 @@
1087       Do this::
1088 
1089           class Person(models.Model):
1090-              first_name = models.CharField(maxlength=20)
1091-              last_name = models.CharField(maxlength=40)
1092+              first_name = models.CharField(max_length=20)
1093+              last_name = models.CharField(max_length=40)
1094 
1095               class Meta:
1096                   verbose_name_plural = 'people'
1097@@ -364,8 +364,8 @@
1098       Don't do this::
1099 
1100           class Person(models.Model):
1101-              first_name = models.CharField(maxlength=20)
1102-              last_name = models.CharField(maxlength=40)
1103+              first_name = models.CharField(max_length=20)
1104+              last_name = models.CharField(max_length=40)
1105               class Meta:
1106                   verbose_name_plural = 'people'
1107 
1108@@ -375,8 +375,8 @@
1109               class Meta:
1110                   verbose_name_plural = 'people'
1111 
1112-              first_name = models.CharField(maxlength=20)
1113-              last_name = models.CharField(maxlength=40)
1114+              first_name = models.CharField(max_length=20)
1115+              last_name = models.CharField(max_length=40)
1116 
1117     * The order of model inner classes and standard methods should be as
1118       follows (noting that these are not all required):
1119
1120=== modified file 'docs/db-api.txt'
1121--- docs/db-api.txt     2007-07-25 03:15:05 +0000
1122+++ docs/db-api.txt     2007-07-29 01:59:47 +0000
1123@@ -12,14 +12,14 @@
1124 a weblog application::
1125 
1126     class Blog(models.Model):
1127-        name = models.CharField(maxlength=100)
1128+        name = models.CharField(max_length=100)
1129         tagline = models.TextField()
1130 
1131         def __unicode__(self):
1132             return self.name
1133 
1134     class Author(models.Model):
1135-        name = models.CharField(maxlength=50)
1136+        name = models.CharField(max_length=50)
1137         email = models.URLField()
1138 
1139         def __unicode__(self):
1140@@ -27,7 +27,7 @@
1141 
1142     class Entry(models.Model):
1143         blog = models.ForeignKey(Blog)
1144-        headline = models.CharField(maxlength=255)
1145+        headline = models.CharField(max_length=255)
1146         body_text = models.TextField()
1147         pub_date = models.DateTimeField()
1148         authors = models.ManyToManyField(Author)
1149@@ -1806,8 +1806,8 @@
1150         ('F', 'Female'),
1151     )
1152     class Person(models.Model):
1153-        name = models.CharField(maxlength=20)
1154-        gender = models.CharField(maxlength=1, choices=GENDER_CHOICES)
1155+        name = models.CharField(max_length=20)
1156+        gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
1157 
1158 ...each ``Person`` instance will have a ``get_gender_display()`` method. Example::
1159 
1160
1161=== modified file 'docs/forms.txt'
1162--- docs/forms.txt      2007-07-04 12:11:04 +0000
1163+++ docs/forms.txt      2007-07-29 01:59:50 +0000
1164@@ -37,11 +37,11 @@
1165     )
1166 
1167     class Place(models.Model):
1168-        name = models.CharField(maxlength=100)
1169-        address = models.CharField(maxlength=100, blank=True)
1170-        city = models.CharField(maxlength=50, blank=True)
1171+        name = models.CharField(max_length=100)
1172+        address = models.CharField(max_length=100, blank=True)
1173+        city = models.CharField(max_length=50, blank=True)
1174         state = models.USStateField()
1175-        zip_code = models.CharField(maxlength=5, blank=True)
1176+        zip_code = models.CharField(max_length=5, blank=True)
1177         place_type = models.IntegerField(choices=PLACE_TYPES)
1178 
1179         class Admin:
1180@@ -388,7 +388,7 @@
1181         def __init__(self):
1182             self.fields = (
1183                 forms.EmailField(field_name="from", is_required=True),
1184-                forms.TextField(field_name="subject", length=30, maxlength=200, is_required=True),
1185+                forms.TextField(field_name="subject", length=30, max_length=200, is_required=True),
1186                 forms.SelectField(field_name="urgency", choices=urgency_choices),
1187                 forms.LargeTextField(field_name="contents", is_required=True),
1188             )
1189
1190=== modified file 'docs/model-api.txt'
1191--- docs/model-api.txt  2007-07-20 21:24:30 +0000
1192+++ docs/model-api.txt  2007-07-29 19:34:41 +0000
1193@@ -33,8 +33,8 @@
1194     from django.db import models
1195 
1196     class Person(models.Model):
1197-        first_name = models.CharField(maxlength=30)
1198-        last_name = models.CharField(maxlength=30)
1199+        first_name = models.CharField(max_length=30)
1200+        last_name = models.CharField(max_length=30)
1201 
1202 ``first_name`` and ``last_name`` are *fields* of the model. Each field is
1203 specified as a class attribute, and each attribute maps to a database column.
1204@@ -69,13 +69,13 @@
1205 Example::
1206 
1207     class Musician(models.Model):
1208-        first_name = models.CharField(maxlength=50)
1209-        last_name = models.CharField(maxlength=50)
1210-        instrument = models.CharField(maxlength=100)
1211+        first_name = models.CharField(max_length=50)
1212+        last_name = models.CharField(max_length=50)
1213+        instrument = models.CharField(max_length=100)
1214 
1215     class Album(models.Model):
1216         artist = models.ForeignKey(Musician)
1217-        name = models.CharField(maxlength=100)
1218+        name = models.CharField(max_length=100)
1219         release_date = models.DateField()
1220         num_stars = models.IntegerField()
1221 
1222@@ -142,14 +142,18 @@
1223 
1224 The admin represents this as an ``<input type="text">`` (a single-line input).
1225 
1226-``CharField`` has an extra required argument, ``maxlength``, the maximum length
1227-(in characters) of the field. The maxlength is enforced at the database level
1228+``CharField`` has an extra required argument, ``max_length``, the maximum length
1229+(in characters) of the field. The max_length is enforced at the database level
1230 and in Django's validation.
1231 
1232-``CommaSeparatedIntegerField``
1233+Django veterans: Note that the argument is now called ``max_length`` to
1234+provide consistency throughout Django. There is full legacy support for
1235+the old ``maxlength`` argument, but ``max_length`` is prefered.
1236+       
1237+ ``CommaSeparatedIntegerField``
1238 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1239 
1240-A field of integers separated by commas. As in ``CharField``, the ``maxlength``
1241+A field of integers separated by commas. As in ``CharField``, the ``max_length``
1242 argument is required.
1243 
1244 ``DateField``
1245@@ -217,7 +221,7 @@
1246 ~~~~~~~~~~~~~~
1247 
1248 A ``CharField`` that checks that the value is a valid e-mail address.
1249-This doesn't accept ``maxlength``; its ``maxlength`` is automatically set to
1250+This doesn't accept ``max_length``; its ``max_length`` is automatically set to
1251 75.
1252 
1253 ``FileField``
1254@@ -400,7 +404,7 @@
1255 containing only letters, numbers, underscores or hyphens. They're generally
1256 used in URLs.
1257 
1258-Like a CharField, you can specify ``maxlength``. If ``maxlength`` is
1259+Like a CharField, you can specify ``max_length``. If ``max_length`` is
1260 not specified, Django will use a default length of 50.
1261 
1262 Implies ``db_index=True``.
1263@@ -447,9 +451,9 @@
1264 
1265 The admin represents this as an ``<input type="text">`` (a single-line input).
1266 
1267-``URLField`` takes an optional argument, ``maxlength``, the maximum length (in
1268-characters) of the field. The maxlength is enforced at the database level and
1269-in Django's validation. If you don't specify ``maxlength``, a default of 200
1270+``URLField`` takes an optional argument, ``max_length``, the maximum length (in
1271+characters) of the field. The maximum length is enforced at the database level and
1272+in Django's validation. If you don't specify ``max_length``, a default of 200
1273 is used.
1274 
1275 ``USStateField``
1276@@ -536,7 +540,7 @@
1277             ('M', 'Male'),
1278             ('F', 'Female'),
1279         )
1280-        gender = models.CharField(maxlength=1, choices=GENDER_CHOICES)
1281+        gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
1282 
1283 or outside your model class altogether::
1284 
1285@@ -545,7 +549,7 @@
1286         ('F', 'Female'),
1287     )
1288     class Foo(models.Model):
1289-        gender = models.CharField(maxlength=1, choices=GENDER_CHOICES)
1290+        gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
1291 
1292 For each model field that has ``choices`` set, Django will add a method to
1293 retrieve the human-readable name for the field's current value. See
1294@@ -698,11 +702,11 @@
1295 
1296 In this example, the verbose name is ``"Person's first name"``::
1297 
1298-    first_name = models.CharField("Person's first name", maxlength=30)
1299+    first_name = models.CharField("Person's first name", max_length=30)
1300 
1301 In this example, the verbose name is ``"first name"``::
1302 
1303-    first_name = models.CharField(maxlength=30)
1304+    first_name = models.CharField(max_length=30)
1305 
1306 ``ForeignKey``, ``ManyToManyField`` and ``OneToOneField`` require the first
1307 argument to be a model class, so use the ``verbose_name`` keyword argument::
1308@@ -1027,8 +1031,8 @@
1309 ``Field`` type::
1310 
1311     class Person(models.Model):
1312-        name = models.CharField(maxlength=80)
1313-        gender = models.CharField(maxlength=1)
1314+        name = models.CharField(max_length=80)
1315+        gender = models.CharField(max_length=1)
1316         something_else = MytypeField()
1317 
1318 If you aim to build a database-agnostic application, you should account for
1319@@ -1074,12 +1078,12 @@
1320 
1321     # This is a much more flexible example.
1322     class BetterCharField(models.Field):
1323-        def __init__(self, maxlength, *args, **kwargs):
1324-            self.maxlength = maxlength
1325+        def __init__(self, max_length, *args, **kwargs):
1326+            self.max_length = max_length
1327             super(BetterCharField, self).__init__(*args, **kwargs)
1328 
1329         def db_type(self):
1330-            return 'char(%s)' % self.maxlength
1331+            return 'char(%s)' % self.max_length
1332 
1333     # In the model:
1334     class MyModel(models.Model):
1335@@ -1096,7 +1100,7 @@
1336 Give your model metadata by using an inner ``class Meta``, like so::
1337 
1338     class Foo(models.Model):
1339-        bar = models.CharField(maxlength=30)
1340+        bar = models.CharField(max_length=30)
1341 
1342         class Meta:
1343             # ...
1344@@ -1270,8 +1274,8 @@
1345 inner ``"class Admin"``, like so::
1346 
1347     class Person(models.Model):
1348-        first_name = models.CharField(maxlength=30)
1349-        last_name = models.CharField(maxlength=30)
1350+        first_name = models.CharField(max_length=30)
1351+        last_name = models.CharField(max_length=30)
1352 
1353         class Admin:
1354             # Admin options go here
1355@@ -1430,7 +1434,7 @@
1356       Here's a full example model::
1357 
1358           class Person(models.Model):
1359-              name = models.CharField(maxlength=50)
1360+              name = models.CharField(max_length=50)
1361               birthday = models.DateField()
1362 
1363               class Admin:
1364@@ -1447,9 +1451,9 @@
1365       Here's a full example model::
1366 
1367           class Person(models.Model):
1368-              first_name = models.CharField(maxlength=50)
1369-              last_name = models.CharField(maxlength=50)
1370-              color_code = models.CharField(maxlength=6)
1371+              first_name = models.CharField(max_length=50)
1372+              last_name = models.CharField(max_length=50)
1373+              color_code = models.CharField(max_length=6)
1374 
1375               class Admin:
1376                   list_display = ('first_name', 'last_name', 'colored_name')
1377@@ -1465,7 +1469,7 @@
1378       Here's a full example model::
1379 
1380           class Person(models.Model):
1381-              first_name = models.CharField(maxlength=50)
1382+              first_name = models.CharField(max_length=50)
1383               birthday = models.DateField()
1384 
1385               class Admin:
1386@@ -1493,8 +1497,8 @@
1387       For example::
1388 
1389         class Person(models.Model):
1390-            first_name = models.CharField(maxlength=50)
1391-            color_code = models.CharField(maxlength=6)
1392+            first_name = models.CharField(max_length=50)
1393+            color_code = models.CharField(max_length=6)
1394 
1395             class Admin:
1396                 list_display = ('first_name', 'colored_first_name')
1397@@ -1744,13 +1748,13 @@
1398             return result_list
1399 
1400     class OpinionPoll(models.Model):
1401-        question = models.CharField(maxlength=200)
1402+        question = models.CharField(max_length=200)
1403         poll_date = models.DateField()
1404         objects = PollManager()
1405 
1406     class Response(models.Model):
1407         poll = models.ForeignKey(Poll)
1408-        person_name = models.CharField(maxlength=50)
1409+        person_name = models.CharField(max_length=50)
1410         response = models.TextField()
1411 
1412 With this example, you'd use ``OpinionPoll.objects.with_counts()`` to return
1413@@ -1766,8 +1770,8 @@
1414 example, using this model::
1415 
1416     class Book(models.Model):
1417-        title = models.CharField(maxlength=100)
1418-        author = models.CharField(maxlength=50)
1419+        title = models.CharField(max_length=100)
1420+        author = models.CharField(max_length=50)
1421 
1422 ...the statement ``Book.objects.all()`` will return all books in the database.
1423 
1424@@ -1785,8 +1789,8 @@
1425 
1426     # Then hook it into the Book model explicitly.
1427     class Book(models.Model):
1428-        title = models.CharField(maxlength=100)
1429-        author = models.CharField(maxlength=50)
1430+        title = models.CharField(max_length=100)
1431+        author = models.CharField(max_length=50)
1432 
1433         objects = models.Manager() # The default manager.
1434         dahl_objects = DahlBookManager() # The Dahl-specific manager.
1435@@ -1819,9 +1823,9 @@
1436             return super(FemaleManager, self).get_query_set().filter(sex='F')
1437 
1438     class Person(models.Model):
1439-        first_name = models.CharField(maxlength=50)
1440-        last_name = models.CharField(maxlength=50)
1441-        sex = models.CharField(maxlength=1, choices=(('M', 'Male'), ('F', 'Female')))
1442+        first_name = models.CharField(max_length=50)
1443+        last_name = models.CharField(max_length=50)
1444+        sex = models.CharField(max_length=1, choices=(('M', 'Male'), ('F', 'Female')))
1445         people = models.Manager()
1446         men = MaleManager()
1447         women = FemaleManager()
1448@@ -1851,11 +1855,11 @@
1449 For example, this model has a few custom methods::
1450 
1451     class Person(models.Model):
1452-        first_name = models.CharField(maxlength=50)
1453-        last_name = models.CharField(maxlength=50)
1454+        first_name = models.CharField(max_length=50)
1455+        last_name = models.CharField(max_length=50)
1456         birth_date = models.DateField()
1457-        address = models.CharField(maxlength=100)
1458-        city = models.CharField(maxlength=50)
1459+        address = models.CharField(max_length=100)
1460+        city = models.CharField(max_length=50)
1461         state = models.USStateField() # Yes, this is America-centric...
1462 
1463         def baby_boomer_status(self):
1464@@ -1897,8 +1901,8 @@
1465 For example::
1466 
1467     class Person(models.Model):
1468-        first_name = models.CharField(maxlength=50)
1469-        last_name = models.CharField(maxlength=50)
1470+        first_name = models.CharField(max_length=50)
1471+        last_name = models.CharField(max_length=50)
1472 
1473         def __str__(self):
1474             # Note use of django.utils.encoding.smart_str() here because
1475@@ -1915,8 +1919,8 @@
1476 more simply as::
1477 
1478     class Person(models.Model):
1479-        first_name = models.CharField(maxlength=50)
1480-        last_name = models.CharField(maxlength=50)
1481+        first_name = models.CharField(max_length=50)
1482+        last_name = models.CharField(max_length=50)
1483 
1484         def __unicode__(self):
1485             return u'%s %s' % (self.first_name, self.last_name)
1486@@ -2056,7 +2060,7 @@
1487 to happen whenever you save an object. For example::
1488 
1489     class Blog(models.Model):
1490-        name = models.CharField(maxlength=100)
1491+        name = models.CharField(max_length=100)
1492         tagline = models.TextField()
1493 
1494         def save(self):
1495@@ -2067,7 +2071,7 @@
1496 You can also prevent saving::
1497 
1498     class Blog(models.Model):
1499-        name = models.CharField(maxlength=100)
1500+        name = models.CharField(max_length=100)
1501         tagline = models.TextField()
1502 
1503         def save(self):
1504
1505=== modified file 'docs/newforms.txt'
1506--- docs/newforms.txt   2007-07-13 21:20:07 +0000
1507+++ docs/newforms.txt   2007-07-29 19:58:31 +0000
1508@@ -1372,7 +1372,7 @@
1509     ``AutoField``                    Not represented in the form
1510     ``BooleanField``                 ``BooleanField``
1511     ``CharField``                    ``CharField`` with ``max_length`` set to
1512-                                     the model field's ``maxlength``
1513+                                     the model field's ``max_length``
1514     ``CommaSeparatedIntegerField``   ``CharField``
1515     ``DateField``                    ``DateField``
1516     ``DateTimeField``                ``DateTimeField``
1517@@ -1452,15 +1452,15 @@
1518     )
1519 
1520     class Author(models.Model):
1521-        name = models.CharField(maxlength=100)
1522-        title = models.CharField(maxlength=3, choices=TITLE_CHOICES)
1523+        name = models.CharField(max_length=100)
1524+        title = models.CharField(max_length=3, choices=TITLE_CHOICES)
1525         birth_date = models.DateField(blank=True, null=True)
1526 
1527         def __unicode__(self):
1528             return self.name
1529 
1530     class Book(models.Model):
1531-        name = models.CharField(maxlength=100)
1532+        name = models.CharField(max_length=100)
1533         authors = models.ManyToManyField(Author)
1534 
1535 With these models, a call to ``form_for_model(Author)`` would return a ``Form``
1536
1537=== modified file 'docs/overview.txt'
1538--- docs/overview.txt   2007-07-10 02:34:42 +0000
1539+++ docs/overview.txt   2007-07-29 01:59:34 +0000
1540@@ -25,14 +25,14 @@
1541 quick example::
1542 
1543     class Reporter(models.Model):
1544-        full_name = models.CharField(maxlength=70)
1545+        full_name = models.CharField(max_length=70)
1546 
1547         def __unicode__(self):
1548             return self.full_name
1549 
1550     class Article(models.Model):
1551         pub_date = models.DateTimeField()
1552-        headline = models.CharField(maxlength=200)
1553+        headline = models.CharField(max_length=200)
1554         article = models.TextField()
1555         reporter = models.ForeignKey(Reporter)
1556 
1557@@ -134,7 +134,7 @@
1558 
1559     class Article(models.Model):
1560         pub_date = models.DateTimeField()
1561-        headline = models.CharField(maxlength=200)
1562+        headline = models.CharField(max_length=200)
1563         article = models.TextField()
1564         reporter = models.ForeignKey(Reporter)
1565         class Admin: pass
1566
1567=== modified file 'docs/sites.txt'
1568--- docs/sites.txt      2007-07-12 05:28:04 +0000
1569+++ docs/sites.txt      2007-07-29 01:59:54 +0000
1570@@ -46,7 +46,7 @@
1571     from django.contrib.sites.models import Site
1572 
1573     class Article(models.Model):
1574-        headline = models.CharField(maxlength=200)
1575+        headline = models.CharField(max_length=200)
1576         # ...
1577         sites = models.ManyToManyField(Site)
1578 
1579@@ -87,7 +87,7 @@
1580     from django.contrib.sites.models import Site
1581 
1582     class Article(models.Model):
1583-        headline = models.CharField(maxlength=200)
1584+        headline = models.CharField(max_length=200)
1585         # ...
1586         site = models.ForeignKey(Site)
1587 
1588@@ -229,7 +229,7 @@
1589 
1590     class Photo(models.Model):
1591         photo = models.FileField(upload_to='/home/photos')
1592-        photographer_name = models.CharField(maxlength=100)
1593+        photographer_name = models.CharField(max_length=100)
1594         pub_date = models.DateField()
1595         site = models.ForeignKey(Site)
1596         objects = models.Manager()
1597@@ -257,7 +257,7 @@
1598 
1599     class Photo(models.Model):
1600         photo = models.FileField(upload_to='/home/photos')
1601-        photographer_name = models.CharField(maxlength=100)
1602+        photographer_name = models.CharField(max_length=100)
1603         pub_date = models.DateField()
1604         publish_on = models.ForeignKey(Site)
1605         objects = models.Manager()
1606
1607=== modified file 'docs/testing.txt'
1608--- docs/testing.txt    2007-07-28 07:27:53 +0000
1609+++ docs/testing.txt    2007-07-29 01:59:40 +0000
1610@@ -79,8 +79,8 @@
1611         'The cat says "meow"'
1612         """
1613 
1614-        name = models.CharField(maxlength=20)
1615-        sound = models.CharField(maxlength=20)
1616+        name = models.CharField(max_length=20)
1617+        sound = models.CharField(max_length=20)
1618 
1619         def speak(self):
1620             return 'The %s says "%s"' % (self.name, self.sound)
1621
1622=== modified file 'docs/tutorial01.txt'
1623--- docs/tutorial01.txt 2007-07-10 02:45:11 +0000
1624+++ docs/tutorial01.txt 2007-07-29 01:59:47 +0000
1625@@ -251,12 +251,12 @@
1626     from django.db import models
1627 
1628     class Poll(models.Model):
1629-        question = models.CharField(maxlength=200)
1630+        question = models.CharField(max_length=200)
1631         pub_date = models.DateTimeField('date published')
1632 
1633     class Choice(models.Model):
1634         poll = models.ForeignKey(Poll)
1635-        choice = models.CharField(maxlength=200)
1636+        choice = models.CharField(max_length=200)
1637         votes = models.IntegerField()
1638 
1639 The code is straightforward. Each model is represented by a class that
1640@@ -279,7 +279,7 @@
1641 machine-readable name will suffice as its human-readable name.
1642 
1643 Some ``Field`` classes have required elements. ``CharField``, for example,
1644-requires that you give it a ``maxlength``. That's used not only in the database
1645+requires that you give it a ``max_length``. That's used not only in the database
1646 schema, but in validation, as we'll soon see.
1647 
1648 Finally, note a relationship is defined, using ``models.ForeignKey``. That tells
1649
1650=== modified file 'docs/tutorial02.txt'
1651--- docs/tutorial02.txt 2007-05-21 03:48:52 +0000
1652+++ docs/tutorial02.txt 2007-07-29 01:53:31 +0000
1653@@ -240,7 +240,7 @@
1654 
1655 Then change the other fields in ``Choice`` to give them ``core=True``::
1656 
1657-    choice = models.CharField(maxlength=200, core=True)
1658+    choice = models.CharField(max_length=200, core=True)
1659     votes = models.IntegerField(core=True)
1660 
1661 This tells Django: "When you edit a Choice on the Poll admin page, the 'choice'
1662
1663=== modified file 'tests/modeltests/basic/models.py'
1664--- tests/modeltests/basic/models.py    2007-07-05 10:27:22 +0000
1665+++ tests/modeltests/basic/models.py    2007-07-29 02:00:12 +0000
1666@@ -8,7 +8,7 @@
1667 from django.db import models
1668 
1669 class Article(models.Model):
1670-    headline = models.CharField(maxlength=100, default='Default headline')
1671+    headline = models.CharField(max_length=100, default='Default headline')
1672     pub_date = models.DateTimeField()
1673 
1674     class Meta:
1675
1676=== modified file 'tests/modeltests/choices/models.py'
1677--- tests/modeltests/choices/models.py  2007-07-04 12:11:04 +0000
1678+++ tests/modeltests/choices/models.py  2007-07-29 02:00:12 +0000
1679@@ -17,8 +17,8 @@
1680 )
1681 
1682 class Person(models.Model):
1683-    name = models.CharField(maxlength=20)
1684-    gender = models.CharField(maxlength=1, choices=GENDER_CHOICES)
1685+    name = models.CharField(max_length=20)
1686+    gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
1687 
1688     def __unicode__(self):
1689         return self.name
1690
1691=== modified file 'tests/modeltests/custom_columns/models.py'
1692--- tests/modeltests/custom_columns/models.py   2007-07-04 12:11:04 +0000
1693+++ tests/modeltests/custom_columns/models.py   2007-07-29 19:59:36 +0000
1694@@ -18,8 +18,8 @@
1695 from django.db import models
1696 
1697 class Author(models.Model):
1698-    first_name = models.CharField(maxlength=30, db_column='firstname')
1699-    last_name = models.CharField(maxlength=30, db_column='last')
1700+    first_name = models.CharField(max_length=30, db_column='firstname')
1701+    last_name = models.CharField(max_length=30, db_column='last')
1702 
1703     def __unicode__(self):
1704         return u'%s %s' % (self.first_name, self.last_name)
1705@@ -29,7 +29,7 @@
1706         ordering = ('last_name','first_name')
1707 
1708 class Article(models.Model):
1709-    headline = models.CharField(maxlength=100)
1710+    headline = models.CharField(max_length=100)
1711     authors = models.ManyToManyField(Author, db_table='my_m2m_table')
1712 
1713     def __unicode__(self):
1714
1715=== modified file 'tests/modeltests/custom_managers/models.py'
1716--- tests/modeltests/custom_managers/models.py  2007-07-04 12:11:04 +0000
1717+++ tests/modeltests/custom_managers/models.py  2007-07-29 01:59:48 +0000
1718@@ -18,8 +18,8 @@
1719         return self.filter(fun=True)
1720 
1721 class Person(models.Model):
1722-    first_name = models.CharField(maxlength=30)
1723-    last_name = models.CharField(maxlength=30)
1724+    first_name = models.CharField(max_length=30)
1725+    last_name = models.CharField(max_length=30)
1726     fun = models.BooleanField()
1727     objects = PersonManager()
1728 
1729@@ -33,8 +33,8 @@
1730         return super(PublishedBookManager, self).get_query_set().filter(is_published=True)
1731 
1732 class Book(models.Model):
1733-    title = models.CharField(maxlength=50)
1734-    author = models.CharField(maxlength=30)
1735+    title = models.CharField(max_length=50)
1736+    author = models.CharField(max_length=30)
1737     is_published = models.BooleanField()
1738     published_objects = PublishedBookManager()
1739     authors = models.ManyToManyField(Person, related_name='books')
1740@@ -49,7 +49,7 @@
1741         return super(FastCarManager, self).get_query_set().filter(top_speed__gt=150)
1742 
1743 class Car(models.Model):
1744-    name = models.CharField(maxlength=10)
1745+    name = models.CharField(max_length=10)
1746     mileage = models.IntegerField()
1747     top_speed = models.IntegerField(help_text="In miles per hour.")
1748     cars = models.Manager()
1749
1750=== modified file 'tests/modeltests/custom_methods/models.py'
1751--- tests/modeltests/custom_methods/models.py   2007-07-04 12:11:04 +0000
1752+++ tests/modeltests/custom_methods/models.py   2007-07-29 02:00:12 +0000
1753@@ -8,7 +8,7 @@
1754 import datetime
1755 
1756 class Article(models.Model):
1757-    headline = models.CharField(maxlength=100)
1758+    headline = models.CharField(max_length=100)
1759     pub_date = models.DateField()
1760 
1761     def __unicode__(self):
1762
1763=== modified file 'tests/modeltests/custom_pk/models.py'
1764--- tests/modeltests/custom_pk/models.py        2007-07-04 12:11:04 +0000
1765+++ tests/modeltests/custom_pk/models.py        2007-07-29 02:00:12 +0000
1766@@ -8,10 +8,10 @@
1767 from django.db import models
1768 
1769 class Employee(models.Model):
1770-    employee_code = models.CharField(maxlength=10, primary_key=True,
1771+    employee_code = models.CharField(max_length=10, primary_key=True,
1772             db_column = 'code')
1773-    first_name = models.CharField(maxlength=20)
1774-    last_name = models.CharField(maxlength=20)
1775+    first_name = models.CharField(max_length=20)
1776+    last_name = models.CharField(max_length=20)
1777     class Meta:
1778         ordering = ('last_name', 'first_name')
1779 
1780@@ -19,7 +19,7 @@
1781         return u"%s %s" % (self.first_name, self.last_name)
1782 
1783 class Business(models.Model):
1784-    name = models.CharField(maxlength=20, primary_key=True)
1785+    name = models.CharField(max_length=20, primary_key=True)
1786     employees = models.ManyToManyField(Employee)
1787     class Meta:
1788         verbose_name_plural = 'businesses'
1789
1790=== modified file 'tests/modeltests/field_defaults/models.py'
1791--- tests/modeltests/field_defaults/models.py   2007-07-04 12:11:04 +0000
1792+++ tests/modeltests/field_defaults/models.py   2007-07-29 01:59:39 +0000
1793@@ -13,7 +13,7 @@
1794 from datetime import datetime
1795 
1796 class Article(models.Model):
1797-    headline = models.CharField(maxlength=100, default='Default headline')
1798+    headline = models.CharField(max_length=100, default='Default headline')
1799     pub_date = models.DateTimeField(default=datetime.now)
1800 
1801     def __unicode__(self):
1802
1803=== modified file 'tests/modeltests/fixtures/models.py'
1804--- tests/modeltests/fixtures/models.py 2007-07-04 12:11:04 +0000
1805+++ tests/modeltests/fixtures/models.py 2007-07-29 20:00:01 +0000
1806@@ -11,7 +11,7 @@
1807 from django.db import models
1808 
1809 class Article(models.Model):
1810-    headline = models.CharField(maxlength=100, default='Default headline')
1811+    headline = models.CharField(max_length=100, default='Default headline')
1812     pub_date = models.DateTimeField()
1813 
1814     def __unicode__(self):
1815
1816=== modified file 'tests/modeltests/generic_relations/models.py'
1817--- tests/modeltests/generic_relations/models.py        2007-07-04 12:11:04 +0000
1818+++ tests/modeltests/generic_relations/models.py        2007-07-29 02:00:02 +0000
1819@@ -28,8 +28,8 @@
1820         return self.tag
1821 
1822 class Animal(models.Model):
1823-    common_name = models.CharField(maxlength=150)
1824-    latin_name = models.CharField(maxlength=150)
1825+    common_name = models.CharField(max_length=150)
1826+    latin_name = models.CharField(max_length=150)
1827     
1828     tags = generic.GenericRelation(TaggedItem)
1829 
1830@@ -37,7 +37,7 @@
1831         return self.common_name
1832         
1833 class Vegetable(models.Model):
1834-    name = models.CharField(maxlength=150)
1835+    name = models.CharField(max_length=150)
1836     is_yucky = models.BooleanField(default=True)
1837     
1838     tags = generic.GenericRelation(TaggedItem)
1839@@ -46,7 +46,7 @@
1840         return self.name
1841     
1842 class Mineral(models.Model):
1843-    name = models.CharField(maxlength=150)
1844+    name = models.CharField(max_length=150)
1845     hardness = models.PositiveSmallIntegerField()
1846     
1847     # note the lack of an explicit GenericRelation here...
1848
1849=== modified file 'tests/modeltests/get_latest/models.py'
1850--- tests/modeltests/get_latest/models.py       2007-07-04 12:11:04 +0000
1851+++ tests/modeltests/get_latest/models.py       2007-07-29 01:59:39 +0000
1852@@ -11,7 +11,7 @@
1853 from django.db import models
1854 
1855 class Article(models.Model):
1856-    headline = models.CharField(maxlength=100)
1857+    headline = models.CharField(max_length=100)
1858     pub_date = models.DateField()
1859     expire_date = models.DateField()
1860     class Meta:
1861@@ -21,7 +21,7 @@
1862         return self.headline
1863 
1864 class Person(models.Model):
1865-    name = models.CharField(maxlength=30)
1866+    name = models.CharField(max_length=30)
1867     birthday = models.DateField()
1868 
1869     # Note that this model doesn't have "get_latest_by" set.
1870
1871=== modified file 'tests/modeltests/get_object_or_404/models.py'
1872--- tests/modeltests/get_object_or_404/models.py        2007-07-22 03:41:11 +0000
1873+++ tests/modeltests/get_object_or_404/models.py        2007-07-29 01:59:47 +0000
1874@@ -15,7 +15,7 @@
1875 from django.shortcuts import get_object_or_404, get_list_or_404
1876 
1877 class Author(models.Model):
1878-    name = models.CharField(maxlength=50)
1879+    name = models.CharField(max_length=50)
1880     
1881     def __unicode__(self):
1882         return self.name
1883@@ -26,7 +26,7 @@
1884 
1885 class Article(models.Model):
1886     authors = models.ManyToManyField(Author)
1887-    title = models.CharField(maxlength=50)
1888+    title = models.CharField(max_length=50)
1889     objects = models.Manager()
1890     by_a_sir = ArticleManager()
1891     
1892
1893=== modified file 'tests/modeltests/get_or_create/models.py'
1894--- tests/modeltests/get_or_create/models.py    2007-07-04 12:11:04 +0000
1895+++ tests/modeltests/get_or_create/models.py    2007-07-29 01:59:59 +0000
1896@@ -8,8 +8,8 @@
1897 from django.db import models
1898 
1899 class Person(models.Model):
1900-    first_name = models.CharField(maxlength=100)
1901-    last_name = models.CharField(maxlength=100)
1902+    first_name = models.CharField(max_length=100)
1903+    last_name = models.CharField(max_length=100)
1904     birthday = models.DateField()
1905 
1906     def __unicode__(self):
1907
1908=== modified file 'tests/modeltests/invalid_models/models.py'
1909--- tests/modeltests/invalid_models/models.py   2007-05-21 01:29:58 +0000
1910+++ tests/modeltests/invalid_models/models.py   2007-07-29 19:59:40 +0000
1911@@ -10,26 +10,26 @@
1912     charfield = models.CharField()
1913     decimalfield = models.DecimalField()
1914     filefield = models.FileField()
1915-    prepopulate = models.CharField(maxlength=10, prepopulate_from='bad')
1916-    choices = models.CharField(maxlength=10, choices='bad')
1917-    choices2 = models.CharField(maxlength=10, choices=[(1,2,3),(1,2,3)])
1918-    index = models.CharField(maxlength=10, db_index='bad')
1919+    prepopulate = models.CharField(max_length=10, prepopulate_from='bad')
1920+    choices = models.CharField(max_length=10, choices='bad')
1921+    choices2 = models.CharField(max_length=10, choices=[(1,2,3),(1,2,3)])
1922+    index = models.CharField(max_length=10, db_index='bad')
1923 
1924 class Target(models.Model):
1925-    tgt_safe = models.CharField(maxlength=10)
1926-    clash1 = models.CharField(maxlength=10)
1927-    clash2 = models.CharField(maxlength=10)
1928+    tgt_safe = models.CharField(max_length=10)
1929+    clash1 = models.CharField(max_length=10)
1930+    clash2 = models.CharField(max_length=10)
1931 
1932-    clash1_set = models.CharField(maxlength=10)
1933+    clash1_set = models.CharField(max_length=10)
1934 
1935 class Clash1(models.Model):
1936-    src_safe = models.CharField(maxlength=10, core=True)
1937+    src_safe = models.CharField(max_length=10, core=True)
1938 
1939     foreign = models.ForeignKey(Target)
1940     m2m = models.ManyToManyField(Target)
1941 
1942 class Clash2(models.Model):
1943-    src_safe = models.CharField(maxlength=10, core=True)
1944+    src_safe = models.CharField(max_length=10, core=True)
1945 
1946     foreign_1 = models.ForeignKey(Target, related_name='id')
1947     foreign_2 = models.ForeignKey(Target, related_name='src_safe')
1948@@ -38,7 +38,7 @@
1949     m2m_2 = models.ManyToManyField(Target, related_name='src_safe')
1950 
1951 class Target2(models.Model):
1952-    clash3 = models.CharField(maxlength=10)
1953+    clash3 = models.CharField(max_length=10)
1954     foreign_tgt = models.ForeignKey(Target)
1955     clashforeign_set = models.ForeignKey(Target)
1956 
1957@@ -46,7 +46,7 @@
1958     clashm2m_set = models.ManyToManyField(Target)
1959 
1960 class Clash3(models.Model):
1961-    src_safe = models.CharField(maxlength=10, core=True)
1962+    src_safe = models.CharField(max_length=10, core=True)
1963     
1964     foreign_1 = models.ForeignKey(Target2, related_name='foreign_tgt')
1965     foreign_2 = models.ForeignKey(Target2, related_name='m2m_tgt')
1966@@ -61,16 +61,16 @@
1967     m2m = models.ManyToManyField(Target2)
1968 
1969 class SelfClashForeign(models.Model):
1970-    src_safe = models.CharField(maxlength=10, core=True)
1971-    selfclashforeign = models.CharField(maxlength=10)
1972+    src_safe = models.CharField(max_length=10, core=True)
1973+    selfclashforeign = models.CharField(max_length=10)
1974 
1975     selfclashforeign_set = models.ForeignKey("SelfClashForeign")
1976     foreign_1 = models.ForeignKey("SelfClashForeign", related_name='id')
1977     foreign_2 = models.ForeignKey("SelfClashForeign", related_name='src_safe')
1978 
1979 class ValidM2M(models.Model):
1980-    src_safe = models.CharField(maxlength=10)
1981-    validm2m = models.CharField(maxlength=10)
1982+    src_safe = models.CharField(max_length=10)
1983+    validm2m = models.CharField(max_length=10)
1984 
1985     # M2M fields are symmetrical by default. Symmetrical M2M fields
1986     # on self don't require a related accessor, so many potential
1987@@ -84,8 +84,8 @@
1988     m2m_4 = models.ManyToManyField('self')
1989 
1990 class SelfClashM2M(models.Model):
1991-    src_safe = models.CharField(maxlength=10)
1992-    selfclashm2m = models.CharField(maxlength=10)
1993+    src_safe = models.CharField(max_length=10)
1994+    selfclashm2m = models.CharField(max_length=10)
1995 
1996     # Non-symmetrical M2M fields _do_ have related accessors, so
1997     # there is potential for clashes.
1998@@ -100,14 +100,14 @@
1999 class Model(models.Model):
2000     "But it's valid to call a model Model."
2001     year = models.PositiveIntegerField() #1960
2002-    make = models.CharField(maxlength=10) #Aston Martin
2003-    name = models.CharField(maxlength=10) #DB 4 GT
2004+    make = models.CharField(max_length=10) #Aston Martin
2005+    name = models.CharField(max_length=10) #DB 4 GT
2006 
2007 class Car(models.Model):
2008-    colour = models.CharField(maxlength=5)
2009+    colour = models.CharField(max_length=5)
2010     model = models.ForeignKey(Model)
2011 
2012-model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "maxlength" attribute.
2013+model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "max_length" attribute.
2014 invalid_models.fielderrors: "decimalfield": DecimalFields require a "decimal_places" attribute.
2015 invalid_models.fielderrors: "decimalfield": DecimalFields require a "max_digits" attribute.
2016 invalid_models.fielderrors: "filefield": FileFields require an "upload_to" attribute.
2017
2018=== modified file 'tests/modeltests/lookup/models.py'
2019--- tests/modeltests/lookup/models.py   2007-07-27 21:53:02 +0000
2020+++ tests/modeltests/lookup/models.py   2007-07-29 01:59:46 +0000
2021@@ -8,7 +8,7 @@
2022 from django.conf import settings
2023 
2024 class Article(models.Model):
2025-    headline = models.CharField(maxlength=100)
2026+    headline = models.CharField(max_length=100)
2027     pub_date = models.DateTimeField()
2028     class Meta:
2029         ordering = ('-pub_date', 'headline')
2030
2031=== modified file 'tests/modeltests/m2m_and_m2o/models.py'
2032--- tests/modeltests/m2m_and_m2o/models.py      2007-07-04 12:11:04 +0000
2033+++ tests/modeltests/m2m_and_m2o/models.py      2007-07-29 01:59:46 +0000
2034@@ -7,7 +7,7 @@
2035 from django.db import models
2036 
2037 class User(models.Model):
2038-    username = models.CharField(maxlength=20)
2039+    username = models.CharField(max_length=20)
2040 
2041 class Issue(models.Model):
2042     num = models.IntegerField()
2043
2044=== modified file 'tests/modeltests/m2m_intermediary/models.py'
2045--- tests/modeltests/m2m_intermediary/models.py 2007-07-04 12:11:04 +0000
2046+++ tests/modeltests/m2m_intermediary/models.py 2007-07-29 01:59:46 +0000
2047@@ -13,14 +13,14 @@
2048 from django.db import models
2049 
2050 class Reporter(models.Model):
2051-    first_name = models.CharField(maxlength=30)
2052-    last_name = models.CharField(maxlength=30)
2053+    first_name = models.CharField(max_length=30)
2054+    last_name = models.CharField(max_length=30)
2055 
2056     def __unicode__(self):
2057         return u"%s %s" % (self.first_name, self.last_name)
2058 
2059 class Article(models.Model):
2060-    headline = models.CharField(maxlength=100)
2061+    headline = models.CharField(max_length=100)
2062     pub_date = models.DateField()
2063 
2064     def __unicode__(self):
2065@@ -29,7 +29,7 @@
2066 class Writer(models.Model):
2067     reporter = models.ForeignKey(Reporter)
2068     article = models.ForeignKey(Article)
2069-    position = models.CharField(maxlength=100)
2070+    position = models.CharField(max_length=100)
2071 
2072     def __unicode__(self):
2073         return u'%s (%s)' % (self.reporter, self.position)
2074
2075=== modified file 'tests/modeltests/m2m_multiple/models.py'
2076--- tests/modeltests/m2m_multiple/models.py     2007-07-04 12:11:04 +0000
2077+++ tests/modeltests/m2m_multiple/models.py     2007-07-29 02:00:03 +0000
2078@@ -10,7 +10,7 @@
2079 from django.db import models
2080 
2081 class Category(models.Model):
2082-    name = models.CharField(maxlength=20)
2083+    name = models.CharField(max_length=20)
2084     class Meta:
2085        ordering = ('name',)
2086 
2087@@ -18,7 +18,7 @@
2088         return self.name
2089 
2090 class Article(models.Model):
2091-    headline = models.CharField(maxlength=50)
2092+    headline = models.CharField(max_length=50)
2093     pub_date = models.DateTimeField()
2094     primary_categories = models.ManyToManyField(Category, related_name='primary_article_set')
2095     secondary_categories = models.ManyToManyField(Category, related_name='secondary_article_set')
2096
2097=== modified file 'tests/modeltests/m2m_recursive/models.py'
2098--- tests/modeltests/m2m_recursive/models.py    2007-07-04 12:11:04 +0000
2099+++ tests/modeltests/m2m_recursive/models.py    2007-07-29 02:00:03 +0000
2100@@ -15,7 +15,7 @@
2101 from django.db import models
2102 
2103 class Person(models.Model):
2104-    name = models.CharField(maxlength=20)
2105+    name = models.CharField(max_length=20)
2106     friends = models.ManyToManyField('self')
2107     idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers')
2108 
2109
2110=== modified file 'tests/modeltests/m2o_recursive/models.py'
2111--- tests/modeltests/m2o_recursive/models.py    2007-07-04 12:11:04 +0000
2112+++ tests/modeltests/m2o_recursive/models.py    2007-07-29 02:00:03 +0000
2113@@ -13,7 +13,7 @@
2114 from django.db import models
2115 
2116 class Category(models.Model):
2117-    name = models.CharField(maxlength=20)
2118+    name = models.CharField(max_length=20)
2119     parent = models.ForeignKey('self', null=True, related_name='child_set')
2120 
2121     def __unicode__(self):
2122
2123=== modified file 'tests/modeltests/m2o_recursive2/models.py'
2124--- tests/modeltests/m2o_recursive2/models.py   2007-07-04 12:11:04 +0000
2125+++ tests/modeltests/m2o_recursive2/models.py   2007-07-29 02:00:03 +0000
2126@@ -10,7 +10,7 @@
2127 from django.db import models
2128 
2129 class Person(models.Model):
2130-    full_name = models.CharField(maxlength=20)
2131+    full_name = models.CharField(max_length=20)
2132     mother = models.ForeignKey('self', null=True, related_name='mothers_child_set')
2133     father = models.ForeignKey('self', null=True, related_name='fathers_child_set')
2134 
2135
2136=== modified file 'tests/modeltests/manipulators/models.py'
2137--- tests/modeltests/manipulators/models.py     2007-07-10 12:03:36 +0000
2138+++ tests/modeltests/manipulators/models.py     2007-07-29 01:59:35 +0000
2139@@ -7,14 +7,14 @@
2140 from django.db import models
2141 
2142 class Musician(models.Model):
2143-    first_name = models.CharField(maxlength=30)
2144-    last_name = models.CharField(maxlength=30)
2145+    first_name = models.CharField(max_length=30)
2146+    last_name = models.CharField(max_length=30)
2147 
2148     def __unicode__(self):
2149         return u"%s %s" % (self.first_name, self.last_name)
2150 
2151 class Album(models.Model):
2152-    name = models.CharField(maxlength=100)
2153+    name = models.CharField(max_length=100)
2154     musician = models.ForeignKey(Musician)
2155     release_date = models.DateField(blank=True, null=True)
2156 
2157
2158=== modified file 'tests/modeltests/many_to_many/models.py'
2159--- tests/modeltests/many_to_many/models.py     2007-07-04 12:11:04 +0000
2160+++ tests/modeltests/many_to_many/models.py     2007-07-29 01:59:35 +0000
2161@@ -10,7 +10,7 @@
2162 from django.db import models
2163 
2164 class Publication(models.Model):
2165-    title = models.CharField(maxlength=30)
2166+    title = models.CharField(max_length=30)
2167 
2168     def __unicode__(self):
2169         return self.title
2170@@ -19,7 +19,7 @@
2171         ordering = ('title',)
2172 
2173 class Article(models.Model):
2174-    headline = models.CharField(maxlength=100)
2175+    headline = models.CharField(max_length=100)
2176     publications = models.ManyToManyField(Publication)
2177 
2178     def __unicode__(self):
2179
2180=== modified file 'tests/modeltests/many_to_one/models.py'
2181--- tests/modeltests/many_to_one/models.py      2007-07-04 12:11:04 +0000
2182+++ tests/modeltests/many_to_one/models.py      2007-07-29 01:59:44 +0000
2183@@ -7,15 +7,15 @@
2184 from django.db import models
2185 
2186 class Reporter(models.Model):
2187-    first_name = models.CharField(maxlength=30)
2188-    last_name = models.CharField(maxlength=30)
2189+    first_name = models.CharField(max_length=30)
2190+    last_name = models.CharField(max_length=30)
2191     email = models.EmailField()
2192 
2193     def __unicode__(self):
2194         return u"%s %s" % (self.first_name, self.last_name)
2195 
2196 class Article(models.Model):
2197-    headline = models.CharField(maxlength=100)
2198+    headline = models.CharField(max_length=100)
2199     pub_date = models.DateField()
2200     reporter = models.ForeignKey(Reporter)
2201 
2202
2203=== modified file 'tests/modeltests/many_to_one_null/models.py'
2204--- tests/modeltests/many_to_one_null/models.py 2007-07-04 12:11:04 +0000
2205+++ tests/modeltests/many_to_one_null/models.py 2007-07-29 01:59:41 +0000
2206@@ -8,13 +8,13 @@
2207 from django.db import models
2208 
2209 class Reporter(models.Model):
2210-    name = models.CharField(maxlength=30)
2211+    name = models.CharField(max_length=30)
2212 
2213     def __unicode__(self):
2214         return self.name
2215 
2216 class Article(models.Model):
2217-    headline = models.CharField(maxlength=100)
2218+    headline = models.CharField(max_length=100)
2219     reporter = models.ForeignKey(Reporter, null=True)
2220 
2221     class Meta:
2222
2223=== modified file 'tests/modeltests/model_forms/models.py'
2224--- tests/modeltests/model_forms/models.py      2007-07-04 12:11:04 +0000
2225+++ tests/modeltests/model_forms/models.py      2007-07-29 19:59:10 +0000
2226@@ -31,20 +31,20 @@
2227 )
2228 
2229 class Category(models.Model):
2230-    name = models.CharField(maxlength=20)
2231-    url = models.CharField('The URL', maxlength=40)
2232+    name = models.CharField(max_length=20)
2233+    url = models.CharField('The URL', max_length=40)
2234 
2235     def __unicode__(self):
2236         return self.name
2237 
2238 class Writer(models.Model):
2239-    name = models.CharField(maxlength=50, help_text='Use both first and last names.')
2240+    name = models.CharField(max_length=50, help_text='Use both first and last names.')
2241 
2242     def __unicode__(self):
2243         return self.name
2244 
2245 class Article(models.Model):
2246-    headline = models.CharField(maxlength=50)
2247+    headline = models.CharField(max_length=50)
2248     pub_date = models.DateField()
2249     created = models.DateField(editable=False)
2250     writer = models.ForeignKey(Writer)
2251@@ -63,7 +63,7 @@
2252 
2253 class PhoneNumber(models.Model):
2254     phone = models.PhoneNumberField()
2255-    description = models.CharField(maxlength=20)
2256+    description = models.CharField(max_length=20)
2257 
2258     def __unicode__(self):
2259         return self.phone
2260
2261=== modified file 'tests/modeltests/model_inheritance/models.py'
2262--- tests/modeltests/model_inheritance/models.py        2007-07-04 12:11:04 +0000
2263+++ tests/modeltests/model_inheritance/models.py        2007-07-29 01:59:41 +0000
2264@@ -7,8 +7,8 @@
2265 from django.db import models
2266 
2267 class Place(models.Model):
2268-    name = models.CharField(maxlength=50)
2269-    address = models.CharField(maxlength=80)
2270+    name = models.CharField(max_length=50)
2271+    address = models.CharField(max_length=80)
2272 
2273     def __unicode__(self):
2274         return u"%s the place" % self.name
2275
2276=== modified file 'tests/modeltests/mutually_referential/models.py'
2277--- tests/modeltests/mutually_referential/models.py     2006-08-27 13:59:47 +0000
2278+++ tests/modeltests/mutually_referential/models.py     2007-07-29 01:23:45 +0000
2279@@ -7,11 +7,11 @@
2280 from django.db.models import *
2281 
2282 class Parent(Model):
2283-    name = CharField(maxlength=100, core=True)
2284+    name = CharField(max_length=100, core=True)
2285     bestchild = ForeignKey("Child", null=True, related_name="favoured_by")
2286 
2287 class Child(Model):
2288-    name = CharField(maxlength=100)
2289+    name = CharField(max_length=100)
2290     parent = ForeignKey(Parent)
2291 
2292 __test__ = {'API_TESTS':"""
2293
2294=== modified file 'tests/modeltests/one_to_one/models.py'
2295--- tests/modeltests/one_to_one/models.py       2007-07-04 12:11:04 +0000
2296+++ tests/modeltests/one_to_one/models.py       2007-07-29 01:59:56 +0000
2297@@ -9,8 +9,8 @@
2298 from django.db import models
2299 
2300 class Place(models.Model):
2301-    name = models.CharField(maxlength=50)
2302-    address = models.CharField(maxlength=80)
2303+    name = models.CharField(max_length=50)
2304+    address = models.CharField(max_length=80)
2305 
2306     def __unicode__(self):
2307         return u"%s the place" % self.name
2308@@ -25,18 +25,18 @@
2309 
2310 class Waiter(models.Model):
2311     restaurant = models.ForeignKey(Restaurant)
2312-    name = models.CharField(maxlength=50)
2313+    name = models.CharField(max_length=50)
2314 
2315     def __unicode__(self):
2316         return u"%s the waiter at %s" % (self.name, self.restaurant)
2317 
2318 class ManualPrimaryKey(models.Model):
2319-    primary_key = models.CharField(maxlength=10, primary_key=True)
2320-    name = models.CharField(maxlength = 50)
2321+    primary_key = models.CharField(max_length=10, primary_key=True)
2322+    name = models.CharField(max_length = 50)
2323 
2324 class RelatedModel(models.Model):
2325     link = models.OneToOneField(ManualPrimaryKey)
2326-    name = models.CharField(maxlength = 50)
2327+    name = models.CharField(max_length = 50)
2328 
2329 __test__ = {'API_TESTS':"""
2330 # Create a couple of Places.
2331
2332=== modified file 'tests/modeltests/or_lookups/models.py'
2333--- tests/modeltests/or_lookups/models.py       2007-07-04 12:11:04 +0000
2334+++ tests/modeltests/or_lookups/models.py       2007-07-29 01:59:51 +0000
2335@@ -14,7 +14,7 @@
2336 from django.db import models
2337 
2338 class Article(models.Model):
2339-    headline = models.CharField(maxlength=50)
2340+    headline = models.CharField(max_length=50)
2341     pub_date = models.DateTimeField()
2342 
2343     class Meta:
2344
2345=== modified file 'tests/modeltests/ordering/models.py'
2346--- tests/modeltests/ordering/models.py 2007-07-04 12:11:04 +0000
2347+++ tests/modeltests/ordering/models.py 2007-07-29 01:59:51 +0000
2348@@ -16,7 +16,7 @@
2349 from django.db import models
2350 
2351 class Article(models.Model):
2352-    headline = models.CharField(maxlength=100)
2353+    headline = models.CharField(max_length=100)
2354     pub_date = models.DateTimeField()
2355     class Meta:
2356         ordering = ('-pub_date', 'headline')
2357
2358=== modified file 'tests/modeltests/pagination/models.py'
2359--- tests/modeltests/pagination/models.py       2007-07-04 12:11:04 +0000
2360+++ tests/modeltests/pagination/models.py       2007-07-29 01:59:51 +0000
2361@@ -9,7 +9,7 @@
2362 from django.db import models
2363 
2364 class Article(models.Model):
2365-    headline = models.CharField(maxlength=100, default='Default headline')
2366+    headline = models.CharField(max_length=100, default='Default headline')
2367     pub_date = models.DateTimeField()
2368 
2369     def __unicode__(self):
2370
2371=== modified file 'tests/modeltests/properties/models.py'
2372--- tests/modeltests/properties/models.py       2006-08-27 13:59:47 +0000
2373+++ tests/modeltests/properties/models.py       2007-07-29 01:23:45 +0000
2374@@ -7,8 +7,8 @@
2375 from django.db import models
2376 
2377 class Person(models.Model):
2378-    first_name = models.CharField(maxlength=30)
2379-    last_name = models.CharField(maxlength=30)
2380+    first_name = models.CharField(max_length=30)
2381+    last_name = models.CharField(max_length=30)
2382 
2383     def _get_full_name(self):
2384         return "%s %s" % (self.first_name, self.last_name)
2385
2386=== modified file 'tests/modeltests/reserved_names/models.py'
2387--- tests/modeltests/reserved_names/models.py   2007-07-04 12:11:04 +0000
2388+++ tests/modeltests/reserved_names/models.py   2007-07-29 01:59:47 +0000
2389@@ -10,14 +10,14 @@
2390 from django.db import models
2391 
2392 class Thing(models.Model):
2393-    when = models.CharField(maxlength=1, primary_key=True)
2394-    join = models.CharField(maxlength=1)
2395-    like = models.CharField(maxlength=1)
2396-    drop = models.CharField(maxlength=1)
2397-    alter = models.CharField(maxlength=1)
2398-    having = models.CharField(maxlength=1)
2399-    where = models.DateField(maxlength=1)
2400-    has_hyphen = models.CharField(maxlength=1, db_column='has-hyphen')
2401+    when = models.CharField(max_length=1, primary_key=True)
2402+    join = models.CharField(max_length=1)
2403+    like = models.CharField(max_length=1)
2404+    drop = models.CharField(max_length=1)
2405+    alter = models.CharField(max_length=1)
2406+    having = models.CharField(max_length=1)
2407+    where = models.DateField(max_length=1)
2408+    has_hyphen = models.CharField(max_length=1, db_column='has-hyphen')
2409     class Meta:
2410        db_table = 'select'
2411 
2412
2413=== modified file 'tests/modeltests/reverse_lookup/models.py'
2414--- tests/modeltests/reverse_lookup/models.py   2007-07-04 12:11:04 +0000
2415+++ tests/modeltests/reverse_lookup/models.py   2007-07-29 01:59:52 +0000
2416@@ -7,20 +7,20 @@
2417 from django.db import models
2418 
2419 class User(models.Model):
2420-    name = models.CharField(maxlength=200)
2421+    name = models.CharField(max_length=200)
2422 
2423     def __unicode__(self):
2424         return self.name
2425 
2426 class Poll(models.Model):
2427-    question = models.CharField(maxlength=200)
2428+    question = models.CharField(max_length=200)
2429     creator = models.ForeignKey(User)
2430 
2431     def __unicode__(self):
2432         return self.question
2433 
2434 class Choice(models.Model):
2435-    name = models.CharField(maxlength=100)
2436+    name = models.CharField(max_length=100)
2437     poll = models.ForeignKey(Poll, related_name="poll_choice")
2438     related_poll = models.ForeignKey(Poll, related_name="related_choice")
2439 
2440
2441=== modified file 'tests/modeltests/save_delete_hooks/models.py'
2442--- tests/modeltests/save_delete_hooks/models.py        2007-07-04 12:11:04 +0000
2443+++ tests/modeltests/save_delete_hooks/models.py        2007-07-29 01:59:52 +0000
2444@@ -8,8 +8,8 @@
2445 from django.db import models
2446 
2447 class Person(models.Model):
2448-    first_name = models.CharField(maxlength=20)
2449-    last_name = models.CharField(maxlength=20)
2450+    first_name = models.CharField(max_length=20)
2451+    last_name = models.CharField(max_length=20)
2452 
2453     def __unicode__(self):
2454         return u"%s %s" % (self.first_name, self.last_name)
2455
2456=== modified file 'tests/modeltests/select_related/models.py'
2457--- tests/modeltests/select_related/models.py   2007-07-04 12:11:04 +0000
2458+++ tests/modeltests/select_related/models.py   2007-07-29 20:02:30 +0000
2459@@ -12,48 +12,48 @@
2460 # Who remembers high school biology?
2461 
2462 class Domain(models.Model):
2463-    name = models.CharField(maxlength=50)
2464+    name = models.CharField(max_length=50)
2465     def __unicode__(self):
2466         return self.name
2467 
2468 class Kingdom(models.Model):
2469-    name = models.CharField(maxlength=50)
2470+    name = models.CharField(max_length=50)
2471     domain = models.ForeignKey(Domain)
2472     def __unicode__(self):
2473         return self.name
2474 
2475 class Phylum(models.Model):
2476-    name = models.CharField(maxlength=50)
2477+    name = models.CharField(max_length=50)
2478     kingdom = models.ForeignKey(Kingdom)
2479     def __unicode__(self):
2480         return self.name
2481     
2482 class Klass(models.Model):
2483-    name = models.CharField(maxlength=50)
2484+    name = models.CharField(max_length=50)
2485     phylum = models.ForeignKey(Phylum)
2486     def __unicode__(self):
2487         return self.name
2488     
2489 class Order(models.Model):
2490-    name = models.CharField(maxlength=50)
2491+    name = models.CharField(max_length=50)
2492     klass = models.ForeignKey(Klass)
2493     def __unicode__(self):
2494         return self.name
2495 
2496 class Family(models.Model):
2497-    name = models.CharField(maxlength=50)
2498+    name = models.CharField(max_length=50)
2499     order = models.ForeignKey(Order)
2500     def __unicode__(self):
2501         return self.name
2502 
2503 class Genus(models.Model):
2504-    name = models.CharField(maxlength=50)
2505+    name = models.CharField(max_length=50)
2506     family = models.ForeignKey(Family)
2507     def __unicode__(self):
2508         return self.name
2509 
2510 class Species(models.Model):
2511-    name = models.CharField(maxlength=50)
2512+    name = models.CharField(max_length=50)
2513     genus = models.ForeignKey(Genus)
2514     def __unicode__(self):
2515         return self.name
2516
2517=== modified file 'tests/modeltests/serializers/models.py'
2518--- tests/modeltests/serializers/models.py      2007-07-04 12:11:04 +0000
2519+++ tests/modeltests/serializers/models.py      2007-07-29 02:00:12 +0000
2520@@ -8,7 +8,7 @@
2521 from django.db import models
2522 
2523 class Category(models.Model):
2524-    name = models.CharField(maxlength=20)
2525+    name = models.CharField(max_length=20)
2526 
2527     class Meta:
2528        ordering = ('name',)
2529@@ -17,7 +17,7 @@
2530         return self.name
2531 
2532 class Author(models.Model):
2533-    name = models.CharField(maxlength=20)
2534+    name = models.CharField(max_length=20)
2535 
2536     class Meta:
2537         ordering = ('name',)
2538@@ -27,7 +27,7 @@
2539 
2540 class Article(models.Model):
2541     author = models.ForeignKey(Author)
2542-    headline = models.CharField(maxlength=50)
2543+    headline = models.CharField(max_length=50)
2544     pub_date = models.DateTimeField()
2545     categories = models.ManyToManyField(Category)
2546 
2547
2548=== modified file 'tests/modeltests/str/models.py'
2549--- tests/modeltests/str/models.py      2007-07-14 14:50:35 +0000
2550+++ tests/modeltests/str/models.py      2007-07-29 20:00:08 +0000
2551@@ -17,7 +17,7 @@
2552 from django.db import models
2553 
2554 class Article(models.Model):
2555-    headline = models.CharField(maxlength=100)
2556+    headline = models.CharField(max_length=100)
2557     pub_date = models.DateTimeField()
2558 
2559     def __str__(self):
2560@@ -26,7 +26,7 @@
2561         return self.headline
2562 
2563 class InternationalArticle(models.Model):
2564-    headline = models.CharField(maxlength=100)
2565+    headline = models.CharField(max_length=100)
2566     pub_date = models.DateTimeField()
2567 
2568     def __unicode__(self):
2569
2570=== modified file 'tests/modeltests/transactions/models.py'
2571--- tests/modeltests/transactions/models.py     2007-07-04 12:11:04 +0000
2572+++ tests/modeltests/transactions/models.py     2007-07-29 01:59:35 +0000
2573@@ -10,8 +10,8 @@
2574 from django.db import models
2575 
2576 class Reporter(models.Model):
2577-    first_name = models.CharField(maxlength=30)
2578-    last_name = models.CharField(maxlength=30)
2579+    first_name = models.CharField(max_length=30)
2580+    last_name = models.CharField(max_length=30)
2581     email = models.EmailField()
2582 
2583     def __unicode__(self):
2584
2585=== modified file 'tests/modeltests/validation/models.py'
2586--- tests/modeltests/validation/models.py       2007-07-04 12:11:04 +0000
2587+++ tests/modeltests/validation/models.py       2007-07-29 02:00:12 +0000
2588@@ -12,7 +12,7 @@
2589 
2590 class Person(models.Model):
2591     is_child = models.BooleanField()
2592-    name = models.CharField(maxlength=20)
2593+    name = models.CharField(max_length=20)
2594     birthdate = models.DateField()
2595     favorite_moment = models.DateTimeField()
2596     email = models.EmailField()
2597
2598=== modified file 'tests/regressiontests/bug639/models.py'
2599--- tests/regressiontests/bug639/models.py      2007-02-26 17:50:21 +0000
2600+++ tests/regressiontests/bug639/models.py      2007-07-29 20:04:25 +0000
2601@@ -2,7 +2,7 @@
2602 from django.db import models
2603 
2604 class Photo(models.Model):
2605-    title = models.CharField(maxlength=30)
2606+    title = models.CharField(max_length=30)
2607     image = models.FileField(upload_to=tempfile.gettempdir())
2608     
2609     # Support code for the tests; this keeps track of how many times save() gets
2610
2611=== modified file 'tests/regressiontests/datatypes/models.py'
2612--- tests/regressiontests/datatypes/models.py   2007-06-23 14:16:00 +0000
2613+++ tests/regressiontests/datatypes/models.py   2007-07-29 20:00:14 +0000
2614@@ -7,7 +7,7 @@
2615 from django.conf import settings
2616 
2617 class Donut(models.Model):
2618-    name = models.CharField(maxlength=100)
2619+    name = models.CharField(max_length=100)
2620     is_frosted = models.BooleanField(default=False)
2621     has_sprinkles = models.NullBooleanField()
2622     baked_date = models.DateField(null=True)
2623
2624=== modified file 'tests/regressiontests/fixtures_regress/models.py'
2625--- tests/regressiontests/fixtures_regress/models.py    2007-07-20 12:07:58 +0000
2626+++ tests/regressiontests/fixtures_regress/models.py    2007-07-29 20:04:33 +0000
2627@@ -2,21 +2,21 @@
2628 from django.contrib.auth.models import User
2629 
2630 class Animal(models.Model):
2631-    name = models.CharField(maxlength=150)
2632-    latin_name = models.CharField(maxlength=150)
2633+    name = models.CharField(max_length=150)
2634+    latin_name = models.CharField(max_length=150)
2635 
2636     def __unicode__(self):
2637         return self.common_name
2638 
2639 class Plant(models.Model):
2640-    name = models.CharField(maxlength=150)
2641+    name = models.CharField(max_length=150)
2642 
2643     class Meta:
2644         # For testing when upper case letter in app name; regression for #4057
2645         db_table = "Fixtures_regress_plant"
2646 
2647 class Stuff(models.Model):
2648-    name = models.CharField(maxlength=20, null=True)
2649+    name = models.CharField(max_length=20, null=True)
2650     owner = models.ForeignKey(User, null=True)
2651     
2652     def __unicode__(self):
2653
2654=== modified file 'tests/regressiontests/initial_sql_regress/models.py'
2655--- tests/regressiontests/initial_sql_regress/models.py 2006-08-27 13:59:47 +0000
2656+++ tests/regressiontests/initial_sql_regress/models.py 2007-07-29 01:23:45 +0000
2657@@ -5,7 +5,7 @@
2658 from django.db import models
2659 
2660 class Simple(models.Model):
2661-    name = models.CharField(maxlength = 50)
2662+    name = models.CharField(max_length = 50)
2663 
2664 __test__ = {'API_TESTS':""}
2665 
2666
2667=== modified file 'tests/regressiontests/invalid_admin_options/models.py'
2668--- tests/regressiontests/invalid_admin_options/models.py       2007-01-03 04:14:17 +0000
2669+++ tests/regressiontests/invalid_admin_options/models.py       2007-07-29 01:23:45 +0000
2670@@ -12,7 +12,7 @@
2671 ##This should fail gracefully but is causing a metaclass error
2672 #class BadAdminOption(models.Model):
2673 #    "Test nonexistent admin option"
2674-#    name = models.CharField(maxlength=30)
2675+#    name = models.CharField(max_length=30)
2676 #   
2677 #    class Admin:
2678 #        nonexistent = 'option'
2679@@ -22,7 +22,7 @@
2680         
2681 class ListDisplayBadOne(models.Model):
2682     "Test list_display, list_display must be a list or tuple"
2683-    first_name = models.CharField(maxlength=30)
2684+    first_name = models.CharField(max_length=30)
2685 
2686     class Admin:
2687         list_display = 'first_name'
2688@@ -32,7 +32,7 @@
2689 
2690 class ListDisplayBadTwo(models.Model):
2691     "Test list_display, list_display items must be attributes, methods or properties."
2692-    first_name = models.CharField(maxlength=30)
2693+    first_name = models.CharField(max_length=30)
2694 
2695     class Admin:
2696         list_display = ['first_name','nonexistent']
2697@@ -41,7 +41,7 @@
2698 """       
2699 class ListDisplayBadThree(models.Model):
2700     "Test list_display, list_display items can not be a ManyToManyField."
2701-    first_name = models.CharField(maxlength=30)
2702+    first_name = models.CharField(max_length=30)
2703     nick_names = models.ManyToManyField('ListDisplayGood')
2704 
2705     class Admin:
2706@@ -52,7 +52,7 @@
2707       
2708 class ListDisplayGood(models.Model):
2709     "Test list_display, Admin list_display can be a attribute, method or property."
2710-    first_name = models.CharField(maxlength=30)
2711+    first_name = models.CharField(max_length=30)
2712     
2713     def _last_name(self):
2714         return self.first_name
2715@@ -66,8 +66,8 @@
2716       
2717 class ListDisplayLinksBadOne(models.Model):
2718     "Test list_display_links, item must be included in list_display."
2719-    first_name = models.CharField(maxlength=30)
2720-    last_name = models.CharField(maxlength=30)
2721+    first_name = models.CharField(max_length=30)
2722+    last_name = models.CharField(max_length=30)
2723     
2724     class Admin:
2725         list_display = ['last_name']
2726@@ -78,8 +78,8 @@
2727 
2728 class ListDisplayLinksBadTwo(models.Model):
2729     "Test list_display_links, must be a list or tuple."
2730-    first_name = models.CharField(maxlength=30)
2731-    last_name = models.CharField(maxlength=30)
2732+    first_name = models.CharField(max_length=30)
2733+    last_name = models.CharField(max_length=30)
2734     
2735     class Admin:
2736         list_display = ['first_name','last_name']
2737@@ -92,8 +92,8 @@
2738 ## This is failing but the validation which should fail is not.
2739 #class ListDisplayLinksBadThree(models.Model):
2740 #    "Test list_display_links, must define list_display to use list_display_links."
2741-#    first_name = models.CharField(maxlength=30)
2742-#    last_name = models.CharField(maxlength=30)
2743+#    first_name = models.CharField(max_length=30)
2744+#    last_name = models.CharField(max_length=30)
2745 #   
2746 #    class Admin:
2747 #        list_display_links = ('first_name',)
2748@@ -103,7 +103,7 @@
2749         
2750 class ListDisplayLinksGood(models.Model):
2751     "Test list_display_links, Admin list_display_list can be a attribute, method or property."
2752-    first_name = models.CharField(maxlength=30)
2753+    first_name = models.CharField(max_length=30)
2754     
2755     def _last_name(self):
2756         return self.first_name
2757@@ -118,7 +118,7 @@
2758 
2759 class ListFilterBadOne(models.Model):
2760     "Test list_filter, must be a list or tuple."
2761-    first_name = models.CharField(maxlength=30)
2762+    first_name = models.CharField(max_length=30)
2763     
2764     class Admin:
2765         list_filter = 'first_name'     
2766@@ -128,7 +128,7 @@
2767 
2768 class ListFilterBadTwo(models.Model):
2769     "Test list_filter, must be a field not a property or method."
2770-    first_name = models.CharField(maxlength=30)
2771+    first_name = models.CharField(max_length=30)
2772     
2773     def _last_name(self):
2774         return self.first_name
2775@@ -146,7 +146,7 @@
2776 
2777 class DateHierarchyBadOne(models.Model):
2778     "Test date_hierarchy, must be a date or datetime field."
2779-    first_name = models.CharField(maxlength=30)
2780+    first_name = models.CharField(max_length=30)
2781     birth_day = models.DateField()
2782     
2783     class Admin:
2784@@ -158,7 +158,7 @@
2785 
2786 class DateHierarchyBadTwo(models.Model):
2787     "Test date_hieracrhy, must be a field."
2788-    first_name = models.CharField(maxlength=30)
2789+    first_name = models.CharField(max_length=30)
2790     birth_day = models.DateField()
2791     
2792     class Admin:
2793@@ -169,7 +169,7 @@
2794 
2795 class DateHierarchyGood(models.Model):
2796     "Test date_hieracrhy, must be a field."
2797-    first_name = models.CharField(maxlength=30)
2798+    first_name = models.CharField(max_length=30)
2799     birth_day = models.DateField()
2800     
2801     class Admin:
2802@@ -177,7 +177,7 @@
2803       
2804 class SearchFieldsBadOne(models.Model):
2805     "Test search_fields, must be a list or tuple."
2806-    first_name = models.CharField(maxlength=30)
2807+    first_name = models.CharField(max_length=30)
2808     
2809     class Admin:
2810         search_fields = ('nonexistent')         
2811@@ -188,7 +188,7 @@
2812       
2813 class SearchFieldsBadTwo(models.Model):
2814     "Test search_fields, must be a field."
2815-    first_name = models.CharField(maxlength=30)
2816+    first_name = models.CharField(max_length=30)
2817 
2818     def _last_name(self):
2819         return self.first_name
2820@@ -203,8 +203,8 @@
2821 
2822 class SearchFieldsGood(models.Model):
2823     "Test search_fields, must be a list or tuple."
2824-    first_name = models.CharField(maxlength=30)
2825-    last_name = models.CharField(maxlength=30)
2826+    first_name = models.CharField(max_length=30)
2827+    last_name = models.CharField(max_length=30)
2828     
2829     class Admin:
2830         search_fields = ['first_name','last_name']
2831@@ -212,7 +212,7 @@
2832 
2833 class JsBadOne(models.Model):
2834     "Test js, must be a list or tuple"
2835-    name = models.CharField(maxlength=30)
2836+    name = models.CharField(max_length=30)
2837     
2838     class Admin:
2839         js = 'test.js'
2840@@ -223,7 +223,7 @@
2841 
2842 class SaveAsBad(models.Model):
2843     "Test save_as, should be True or False"
2844-    name = models.CharField(maxlength=30)
2845+    name = models.CharField(max_length=30)
2846     
2847     class Admin:
2848         save_as = 'not True or False'
2849@@ -234,7 +234,7 @@
2850 
2851 class SaveOnTopBad(models.Model):
2852     "Test save_on_top, should be True or False"
2853-    name = models.CharField(maxlength=30)
2854+    name = models.CharField(max_length=30)
2855     
2856     class Admin:
2857         save_on_top = 'not True or False'
2858@@ -245,7 +245,7 @@
2859 
2860 class ListSelectRelatedBad(models.Model):
2861     "Test list_select_related, should be True or False"
2862-    name = models.CharField(maxlength=30)
2863+    name = models.CharField(max_length=30)
2864     
2865     class Admin:
2866         list_select_related = 'not True or False'
2867@@ -256,7 +256,7 @@
2868 
2869 class ListPerPageBad(models.Model):
2870     "Test list_per_page, should be a positive integer value."
2871-    name = models.CharField(maxlength=30)
2872+    name = models.CharField(max_length=30)
2873     
2874     class Admin:
2875         list_per_page = 89.3
2876@@ -267,8 +267,8 @@
2877 
2878 class FieldsBadOne(models.Model):
2879     "Test fields, should be a tuple"
2880-    first_name = models.CharField(maxlength=30)
2881-    last_name = models.CharField(maxlength=30)
2882+    first_name = models.CharField(max_length=30)
2883+    last_name = models.CharField(max_length=30)
2884     
2885     class Admin:
2886         fields = 'not a tuple'
2887@@ -279,8 +279,8 @@
2888 
2889 class FieldsBadTwo(models.Model):
2890     """Test fields, 'fields' dict option is required."""
2891-    first_name = models.CharField(maxlength=30)
2892-    last_name = models.CharField(maxlength=30)
2893+    first_name = models.CharField(max_length=30)
2894+    last_name = models.CharField(max_length=30)
2895     
2896     class Admin:
2897         fields = ('Name', {'description': 'this fieldset needs fields'})
2898@@ -291,8 +291,8 @@
2899 
2900 class FieldsBadThree(models.Model):
2901     """Test fields, 'classes' and 'description' are the only allowable extra dict options."""
2902-    first_name = models.CharField(maxlength=30)
2903-    last_name = models.CharField(maxlength=30)
2904+    first_name = models.CharField(max_length=30)
2905+    last_name = models.CharField(max_length=30)
2906     
2907     class Admin:
2908         fields = ('Name', {'fields': ('first_name','last_name'),'badoption': 'verybadoption'})
2909@@ -303,8 +303,8 @@
2910 
2911 class FieldsGood(models.Model):
2912     "Test fields, working example"
2913-    first_name = models.CharField(maxlength=30)
2914-    last_name = models.CharField(maxlength=30)
2915+    first_name = models.CharField(max_length=30)
2916+    last_name = models.CharField(max_length=30)
2917     birth_day = models.DateField()
2918     
2919     class Admin:
2920@@ -315,8 +315,8 @@
2921                   
2922 class OrderingBad(models.Model):
2923     "Test ordering, must be a field."
2924-    first_name = models.CharField(maxlength=30)
2925-    last_name = models.CharField(maxlength=30)
2926+    first_name = models.CharField(max_length=30)
2927+    last_name = models.CharField(max_length=30)
2928     
2929     class Admin:
2930         ordering = 'nonexistent'
2931@@ -328,7 +328,7 @@
2932 ## TODO: Add a manager validator, this should fail gracefully.
2933 #class ManagerBad(models.Model):
2934 #    "Test manager, must be a manager object."
2935-#    first_name = models.CharField(maxlength=30)
2936+#    first_name = models.CharField(max_length=30)
2937 #   
2938 #    class Admin:
2939 #        manager = 'nonexistent'
2940
2941=== modified file 'tests/regressiontests/many_to_one_regress/models.py'
2942--- tests/regressiontests/many_to_one_regress/models.py 2007-03-08 03:21:35 +0000
2943+++ tests/regressiontests/many_to_one_regress/models.py 2007-07-29 20:01:11 +0000
2944@@ -12,15 +12,15 @@
2945 
2946 # Protect against repetition of #1839, #2415 and #2536.
2947 class Third(models.Model):
2948-    name = models.CharField(maxlength=20)
2949+    name = models.CharField(max_length=20)
2950     third = models.ForeignKey('self', null=True, related_name='child_set')
2951 
2952 class Parent(models.Model):
2953-    name = models.CharField(maxlength=20)
2954+    name = models.CharField(max_length=20)
2955     bestchild = models.ForeignKey('Child', null=True, related_name='favored_by')
2956 
2957 class Child(models.Model):
2958-    name = models.CharField(maxlength=20)
2959+    name = models.CharField(max_length=20)
2960     parent = models.ForeignKey(Parent)
2961 
2962 
2963
2964=== modified file 'tests/regressiontests/model_regress/models.py'
2965--- tests/regressiontests/model_regress/models.py       2007-07-04 12:11:04 +0000
2966+++ tests/regressiontests/model_regress/models.py       2007-07-29 20:04:07 +0000
2967@@ -7,7 +7,7 @@
2968 )
2969 
2970 class Article(models.Model):
2971-    headline = models.CharField(maxlength=100, default='Default headline')
2972+    headline = models.CharField(max_length=100, default='Default headline')
2973     pub_date = models.DateTimeField()
2974     status = models.IntegerField(blank=True, null=True, choices=CHOICES)
2975 
2976
2977=== modified file 'tests/regressiontests/null_queries/models.py'
2978--- tests/regressiontests/null_queries/models.py        2007-07-04 12:11:04 +0000
2979+++ tests/regressiontests/null_queries/models.py        2007-07-29 01:59:40 +0000
2980@@ -1,14 +1,14 @@
2981 from django.db import models
2982 
2983 class Poll(models.Model):
2984-    question = models.CharField(maxlength=200)
2985+    question = models.CharField(max_length=200)
2986 
2987     def __unicode__(self):
2988         return u"Q: %s " % self.question
2989 
2990 class Choice(models.Model):
2991     poll = models.ForeignKey(Poll)
2992-    choice = models.CharField(maxlength=200)
2993+    choice = models.CharField(max_length=200)
2994 
2995     def __unicode__(self):
2996         return u"Choice: %s in poll %s" % (self.choice, self.poll)
2997
2998=== modified file 'tests/regressiontests/one_to_one_regress/models.py'
2999--- tests/regressiontests/one_to_one_regress/models.py  2007-07-04 12:11:04 +0000
3000+++ tests/regressiontests/one_to_one_regress/models.py  2007-07-29 01:59:46 +0000
3001@@ -1,8 +1,8 @@
3002 from django.db import models
3003 
3004 class Place(models.Model):
3005-    name = models.CharField(maxlength=50)
3006-    address = models.CharField(maxlength=80)
3007+    name = models.CharField(max_length=50)
3008+    address = models.CharField(max_length=80)
3009 
3010     def __unicode__(self):
3011         return u"%s the place" % self.name
3012@@ -16,7 +16,7 @@
3013         return u"%s the restaurant" % self.place.name
3014 
3015 class Favorites(models.Model):
3016-    name = models.CharField(maxlength = 50)
3017+    name = models.CharField(max_length = 50)
3018     restaurants = models.ManyToManyField(Restaurant)
3019 
3020     def __unicode__(self):
3021
3022=== modified file 'tests/regressiontests/serializers_regress/models.py'
3023--- tests/regressiontests/serializers_regress/models.py 2007-07-12 11:27:38 +0000
3024+++ tests/regressiontests/serializers_regress/models.py 2007-07-29 20:00:43 +0000
3025@@ -16,7 +16,7 @@
3026     data = models.BooleanField(null=True)
3027 
3028 class CharData(models.Model):
3029-    data = models.CharField(maxlength=30, null=True)
3030+    data = models.CharField(max_length=30, null=True)
3031 
3032 class DateData(models.Model):
3033     data = models.DateField(null=True)
3034@@ -90,7 +90,7 @@
3035         ordering = ["data"]
3036 
3037 class GenericData(models.Model):
3038-    data = models.CharField(maxlength=30)
3039+    data = models.CharField(max_length=30)
3040 
3041     tags = generic.GenericRelation(Tag)
3042     
3043@@ -102,13 +102,13 @@
3044     """This is a model that can be used as
3045     something for other models to point at"""
3046     
3047-    data = models.CharField(maxlength=30)
3048+    data = models.CharField(max_length=30)
3049 
3050 class UniqueAnchor(models.Model):
3051     """This is a model that can be used as
3052     something for other models to point at"""
3053 
3054-    data = models.CharField(unique=True, maxlength=30)
3055+    data = models.CharField(unique=True, max_length=30)
3056     
3057 class FKData(models.Model):
3058     data = models.ForeignKey(Anchor, null=True)
3059@@ -144,7 +144,7 @@
3060     data = models.BooleanField(primary_key=True)
3061     
3062 class CharPKData(models.Model):
3063-    data = models.CharField(maxlength=30, primary_key=True)
3064+    data = models.CharField(max_length=30, primary_key=True)
3065 
3066 # class DatePKData(models.Model):
3067 #    data = models.DateField(primary_key=True)
3068@@ -208,9 +208,9 @@
3069 #     data = models.XMLField(primary_key=True)
3070 
3071 class ComplexModel(models.Model):
3072-    field1 = models.CharField(maxlength=10)
3073-    field2 = models.CharField(maxlength=10)
3074-    field3 = models.CharField(maxlength=10)
3075+    field1 = models.CharField(max_length=10)
3076+    field2 = models.CharField(max_length=10)
3077+    field3 = models.CharField(max_length=10)
3078 
3079 # Tests for handling fields with pre_save functions, or
3080 # models with save functions that modify data
3081
3082=== modified file 'tests/regressiontests/string_lookup/models.py'
3083--- tests/regressiontests/string_lookup/models.py       2007-07-04 12:11:04 +0000
3084+++ tests/regressiontests/string_lookup/models.py       2007-07-29 02:04:16 +0000
3085@@ -2,14 +2,14 @@
3086 from django.db import models
3087 
3088 class Foo(models.Model):
3089-    name = models.CharField(maxlength=50)
3090-    friend = models.CharField(maxlength=50, blank=True)
3091+    name = models.CharField(max_length=50)
3092+    friend = models.CharField(max_length=50, blank=True)
3093 
3094     def __unicode__(self):
3095         return "Foo %s" % self.name
3096 
3097 class Bar(models.Model):
3098-    name = models.CharField(maxlength=50)
3099+    name = models.CharField(max_length=50)
3100     normal = models.ForeignKey(Foo, related_name='normal_foo')
3101     fwd = models.ForeignKey("Whiz")
3102     back = models.ForeignKey("Foo")
3103@@ -18,20 +18,20 @@
3104         return "Bar %s" % self.place.name
3105 
3106 class Whiz(models.Model):
3107-    name = models.CharField(maxlength = 50)
3108+    name = models.CharField(max_length = 50)
3109 
3110     def __unicode__(self):
3111         return "Whiz %s" % self.name
3112 
3113 class Child(models.Model):
3114     parent = models.OneToOneField('Base')
3115-    name = models.CharField(maxlength = 50)
3116+    name = models.CharField(max_length = 50)
3117 
3118     def __unicode__(self):
3119         return "Child %s" % self.name
3120 
3121 class Base(models.Model):
3122-    name = models.CharField(maxlength = 50)
3123+    name = models.CharField(max_length = 50)
3124 
3125     def __unicode__(self):
3126         return "Base %s" % self.name
3127