Saturday, January 25, 2014

Re: Widget attributes in ModelForm

SOLVED:   The correct setting on the CBV is:

form_class =   not   form = 


On Fri, Jan 24, 2014 at 2:09 PM, Timothy W. Cook <tim@mlhim.org> wrote:
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



--
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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WHJL0wFC5z0Oo1vHmaqcPFRc%3Da%2BE7en4ZkeJYvgZ3pYw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment