equal
deleted
inserted
replaced
86 # basic html widgets ########################################################### |
86 # basic html widgets ########################################################### |
87 |
87 |
88 class TextInput(Input): |
88 class TextInput(Input): |
89 """<input type='text'>""" |
89 """<input type='text'>""" |
90 type = 'text' |
90 type = 'text' |
|
91 |
|
92 def render(self, form, field): |
|
93 if hasattr(field, 'max_length') and field.max_length: |
|
94 self.attrs.setdefault('size', min(45, field.max_length)) |
|
95 self.attrs.setdefault('maxlength', field.max_length) |
|
96 return super(TextInput, self).render(form, field) |
|
97 |
91 |
98 |
92 |
99 |
93 class PasswordInput(Input): |
100 class PasswordInput(Input): |
94 """<input type='password'> and its confirmation field (using |
101 """<input type='password'> and its confirmation field (using |
95 <field's name>-confirm as name) |
102 <field's name>-confirm as name) |