#13269: Possible docs error - Overriding the default field types or widgets ---------------------------------------+------------------------------------ Reporter: mattrowbum | Owner: nobody Status: new | Milestone: Component: Documentation | Version: 1.2-beta Keywords: widgets, form field types | Stage: Unreviewed Has_patch: 0 | ---------------------------------------+------------------------------------ Hi.
I'm new to django and am using the development version from SVN v1.2.0 beta.1 (rev 12909) I am unsure of whether there is a problem in the code, docs or my own app. I'm providing this as a solution to a problem I faced, based on information found in the docs. The first example given in the following section of the docs would not work for me... http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding- the-default-field-types-or-widgets {{{ class AuthorForm(ModelForm): class Meta: model = Author fields = ['name', 'title', 'birth_date'] widgets = { 'name': Textarea(attrs={'cols': 80, 'rows': 20}), } }}} From reading through the docs, I presume that the only import required is: {{{ from django.forms import ModelForm }}} When I attempted to run the development server, I receive the following error message: {{{ NameError: name 'Textarea' is not defined }}} My solution was the following: {{{ from django import forms class AuthorForm(forms.ModelForm): class Meta: model = Author fields = ['name', 'title', 'birth_date'] widgets = { 'name': forms.Textarea(attrs={'cols': 80, 'rows': 20}), } }}} In summary, I made the following changes: {{{ Line 1 - from django import forms Line 3 - class AuthorForm(forms.ModelForm): Line 8 - 'name': forms.Textarea(...), }}} I hope this is of some help. -- Ticket URL: <http://code.djangoproject.com/ticket/13269> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.