web/formfields.py
branchstable
changeset 2356 ef9e30485ee7
parent 2348 acf4b6a59558
child 2360 1d43aa551ba9
equal deleted inserted replaced
2355:359903ef980a 2356:ef9e30485ee7
   201         if widget is None:
   201         if widget is None:
   202             if self.choices:
   202             if self.choices:
   203                 widget = Select()
   203                 widget = Select()
   204             elif self.max_length and self.max_length < 257:
   204             elif self.max_length and self.max_length < 257:
   205                 widget = TextInput()
   205                 widget = TextInput()
   206                 widget.attrs.setdefault('size', min(45, self.max_length))
       
   207                 widget.attrs.setdefault('maxlength', self.max_length)
       
   208 
   206 
   209         super(StringField, self).init_widget(widget)
   207         super(StringField, self).init_widget(widget)
   210         if isinstance(self.widget, TextArea):
   208         if isinstance(self.widget, TextArea):
   211             self.init_text_area(self.widget)
   209             self.init_text_area(self.widget)
   212 
   210