Hi, How can I get a TextareaWidget with form_for_model()?
I have a solution, but it is too much code. You need to create an own DB-Field. Is there a better solution? models.py: text=dbfields.TextareaField(max_length=128, rows=4, cols=40, verbose_name="Text", blank=True) dbfields.py: class TextareaField(models.CharField): rows=10 cols=40 def __init__(self, *args, **kwargs): self.rows=kwargs.pop("rows", self.rows) self.cols=kwargs.pop("cols", self.cols) super(self.__class__, self).__init__(*args, **kwargs) def formfield(self, **kwargs): # from db/models/__init__.py/Field.formfield() from django.utils.text import capfirst defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text} defaults = {'max_length': self.max_length} defaults = {'rows': self.rows, 'cols': self.cols} defaults.update(kwargs) return formfields.TextareaFormField(**defaults) formfields.py: class TextareaFormField(forms.CharField): def __init__(self, *args, **kwargs): kwargs["widget"]=forms.widgets.Textarea({"cols": kwargs.pop("cols"), "rows": kwargs.pop("rows")}) return super(self.__class__, self).__init__(*args, **kwargs) Thomas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---