Code

Ticket #675: password_field.diff

File password_field.diff, 998 bytes (added by seancazzell@…, 9 years ago)

small patch (from svn diff) that fixes ticket #675

Line 
1Index: django/core/formfields.py
2===================================================================
3--- django/core/formfields.py   (revision 987)
4+++ django/core/formfields.py   (working copy)
5@@ -247,10 +247,13 @@
6 
7 class PasswordField(TextField):
8     def render(self, data):
9+        maxlength = ''
10+        if self.maxlength:
11+            maxlength = 'maxlength="%s" ' % self.maxlength
12         # value is always blank because we never want to redisplay it
13-        return '<input type="password" id="%s" class="v%s%s" name="%s" value="" />' % \
14+        return '<input type="password" id="%s" class="v%s%s" name="%s" size="%s" value="" %s/>' % \
15             (FORM_FIELD_ID_PREFIX + self.field_name, self.__class__.__name__, self.is_required and ' required' or '',
16-            self.field_name)
17+            self.field_name, self.length, maxlength)
18 
19 class LargeTextField(TextField):
20     def __init__(self, field_name, rows=10, cols=40, is_required=False, validator_list=[], maxlength=None):