Ticket #1679: multiline_fields.patch
File multiline_fields.patch, 2.1 KB (added by , 19 years ago) |
---|
-
django/db/models/fields/__init__.py
67 67 maxlength=None, unique=False, blank=False, null=False, db_index=False, 68 68 core=False, rel=None, default=NOT_PROVIDED, editable=True, 69 69 prepopulate_from=None, unique_for_date=None, unique_for_month=None, 70 unique_for_year=None, validator_list=None, choices=None, radio_admin=None, 70 unique_for_year=None, validator_list=None, choices=None, 71 radio_admin=None, multiline_admin=None, 71 72 help_text='', db_column=None): 72 73 self.name = name 73 74 self.verbose_name = verbose_name … … 82 83 self.unique_for_year = unique_for_year 83 84 self.choices = choices or [] 84 85 self.radio_admin = radio_admin 86 self.multiline_admin = multiline_admin 85 87 self.help_text = help_text 86 88 self.db_column = db_column 87 89 … … 377 379 return [forms.CheckboxField] 378 380 379 381 class CharField(Field): 382 def __init__(self, *args, **kwargs): 383 if 'multiline_admin' not in kwargs: 384 kwargs['multiline_admin'] = False 385 Field.__init__(self, *args, **kwargs) 386 380 387 def get_manipulator_field_objs(self): 381 return [forms.TextField] 388 if self.multiline_admin: 389 return [forms.LargeTextField] 390 else: 391 return [forms.TextField] 382 392 383 393 def to_python(self, value): 384 394 if isinstance(value, basestring): … … 710 720 return [forms.SmallIntegerField] 711 721 712 722 class TextField(Field): 723 def __init__(self, *args, **kwargs): 724 if 'multiline_admin' not in kwargs: 725 kwargs['multiline_admin'] = True 726 Field.__init__(self, *args, **kwargs) 727 713 728 def get_manipulator_field_objs(self): 714 return [forms.LargeTextField] 729 if self.multiline_admin: 730 return [forms.LargeTextField] 731 else: 732 return [forms.TextField] 715 733 716 734 class TimeField(Field): 717 735 empty_strings_allowed = False