Friday, March 6, 2015

Re: what do you think about django FORM system?

El 06/03/15 11:22, john escribió:
I saws that to in the Doc's - it did not work for me with bootstrap.  I did not find the cause - if there wasn't some sort of bug.  I'm using Django 1.7.5 so I'll guess and say it had something to do with the interaction of the two.  I have moved on to crispy-forms and all seems to work.  But like I said at the start - in answer to the question "Could you provide us more in-deapth of your feeling using the django form?"  I found the information provided from the doc's to be confusing and did not explain why I had to subclass.  More examples are needed (and all in one doc - not link after link after link).  Maybe what I'm asking for is for the tutorial to better explain the use and ways to mod the form code to get things done.

I guess you only need to subclass a widget if you want to change appearance and behavior of all instances.
I'm using Django 1.9 and Bootstrap v3.3.1 and I've just tried the example using a CharField in a form like this and worked!

class SearchElementForm(forms.Form):
    q = forms.CharField(label='Search', max_length=30, widget=forms.TextInput(attrs={'size': '40'}))

I wasn't using the size attribute at all but when I tried, it was displayed with a different size every time I changed the size.


Felix

No comments:

Post a Comment