Ticket #4014: textfield.diff
File textfield.diff, 1.1 KB (added by , 18 years ago) |
---|
-
fields.py
18 18 'RegexField', 'EmailField', 'URLField', 'BooleanField', 19 19 'ChoiceField', 'NullBooleanField', 'MultipleChoiceField', 20 20 'ComboField', 'MultiValueField', 21 'SplitDateTimeField', 21 'SplitDateTimeField','TextField' 22 22 ) 23 23 24 24 # These values, if given to to_python(), will trigger the self.required check. … … 88 88 """ 89 89 return {} 90 90 91 class TextField(Field): 92 def __init__(self, rows=10, cols=40, *args, **kwargs): 93 self.rows, self.cols = rows, cols 94 super(TextField, self).__init__(widget=Textarea(attrs={'rows' : self.rows, 'cols' : self.cols}),*args, **kwargs) 95 96 def clean(self, value): 97 pass 98 99 def widget_attrs(self, widget): 100 if isinstance(widget, (Textarea)): 101 return {'columns': self.cols, 'rows': self.rows} 102 91 103 class CharField(Field): 92 104 def __init__(self, max_length=None, min_length=None, *args, **kwargs): 93 105 self.max_length, self.min_length = max_length, min_length