Friday, March 6, 2015

Re: what do you think about django FORM system?

El 06/03/15 10:20, john escribió:
OK I realize you are saying I should read the doc's.  So I will provide exactly what I'm saying from the doc's.

Django handles three distinct parts of the work involved in forms:

  • preparing and restructuring data ready for rendering
  • creating HTML forms for the data
  • receiving and processing submitted forms and data from the client

It is possible to write code that does all of this manually, but Django can take care of it all for you.

I read the above and I say why do I need to subclass anything.  CharField is provided and that's all I really need because it's just a few chars the user is going to enter.  But I need to provide an ID, a SIZE, a few things - where is that info and where are the examples?  Maybe I missed them?  I've been know to mis-read stuff.

something like this you mean?

class CommentForm(forms.Form):      name = forms.CharField(widget=forms.TextInput(attrs={'class': 'special'}))      url = forms.URLField()      comment = forms.CharField(widget=forms.TextInput(attrs={'size': '40'}))    
Cheers,
Felix.
  

No comments:

Post a Comment