Code

Ticket #1568: charfield_size.diff

File charfield_size.diff, 961 bytes (added by LawrenceOluyede, 8 years ago)
Line 
1Index: django/oldforms/__init__.py
2===================================================================
3--- django/oldforms/__init__.py (revision 4270)
4+++ django/oldforms/__init__.py (working copy)
5@@ -395,13 +395,16 @@
6         if data is None:
7             data = ''
8         maxlength = ''
9+        field_size = self.length
10         if self.maxlength:
11             maxlength = 'maxlength="%s" ' % self.maxlength
12+            field_size = self.maxlength
13         if isinstance(data, unicode):
14             data = data.encode(settings.DEFAULT_CHARSET)
15+           
16         return '<input type="%s" id="%s" class="v%s%s" name="%s" size="%s" value="%s" %s/>' % \
17             (self.input_type, self.get_id(), self.__class__.__name__, self.is_required and ' required' or '',
18-            self.field_name, self.length, escape(data), maxlength)
19+            self.field_name, field_size, escape(data), maxlength)
20 
21     def html2python(data):
22         return data