Widget attributes in ModelForm

21 views
Skip to first unread message

Timothy W. Cook

unread,
Jan 24, 2014, 11:09:35 AM1/24/14
to django...@googlegroups.com
My widget attribute settings  aren't having any effect in the render template.  

View:
class DvBooleanCreateView(CreateView):
    template_name = 'dvboolean_create.html'
    success_url = '/dashboard'
    model = DvBoolean
    form = DvBooleanCreateForm
    fields = ['prj_name','data_name','lang','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts',]


Form:
class DvBooleanCreateForm(ModelForm):
    class Meta:
        model = DvBoolean      
        #fields = ['prj_name','data_name','lang','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts',]
        widgets = {
                    'description': Textarea(attrs={'cols':40, 'rows':3}),
                   }


The form as displayed in the browser has the default size with or without the widgets settings in the ModelForm.

What am I missing?

Thanks,
Tim








--
MLHIM VIP Signup: http://goo.gl/22B0U
============================================
Timothy Cook, MSc           +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

Timothy W. Cook

unread,
Jan 25, 2014, 7:44:09 AM1/25/14
to django...@googlegroups.com
SOLVED:   The correct setting on the CBV is:

form_class =   not   form = 
Reply all
Reply to author
Forward
0 new messages