Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 22, 2010 21:27:30

h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Forms Questions


I've been going through a lot of the forms related documentation and
some things are still not clear, partly because of information
overload. First do I have to code/generate my forms using my models?
If not then if I code my form from scratch will it still have all or
most of the background functionality as it would if I had generated it
driectly from the models? Like will I still be able to use field
validators and be able to use some of the methods like is_valid(),
clean(), is_bound, as_p(), as_ul(), as_table(), etc.? I would
appreciate any help, explanations, or links to good examples or
tutorials of using forms, other than the introductory django tutorial.
Thanks in advance for the help.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 22, 2010 21:33:36

r.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Forms Questions


> First do I have to code/generate my forms using my models?

No. Model forms are basically a shortcut to the very common use case
of creating a form to update or save a single model object. With
regular forms, you just have to explicitly declare your form fields
instead of counting on the modelform module to build the fields for
you based on the model.

> If not then if I code my form from scratch will it still have all or
> most of the background functionality as it would if I had generated it
> driectly from the models?

Much of it. You won't have save() functionality built in, and the
only validators run will be those related to your specific form field
declarations, and those you explicitly define yourself -- i.e. it
won't inherit any validation from your models because it's not linked
to your models.

> Like will I still be able to use field
> validators and be able to use some of the methods like is_valid(),
> clean(), is_bound, as_p(), as_ul(), as_table(), etc.?

Yes, all of those.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 22, 2010 21:38:13

Łukasz R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Forms Questions


On 22 December 2010 22:27, hank23 <hversem...@stchas.edu> wrote:
> I've been going through a lot of the forms related documentation and
> some things are still not clear, partly because of information
> overload.

> First do I have to code/generate my forms using my models?
No, forms can be used independently of models.

> If not then if I code my form from scratch will it still have all or
> most of the background functionality as it would if I had generated it
> driectly from the models?
Yes, they just won't be auto-generated from your models.

> Like will I still be able to use field validators,
Yes. Most form fields have some validators defined (like EmailField)
and you can add more:http://docs.djangoproject.com/en/dev/ref/forms/validation/#using-validatorsand be able to use some of the methods like is_valid(),
> clean(), is_bound, as_p(), as_ul(), as_table(), etc.?

Everything except save(), 'cause there is nothing to save.

> I would
> appreciate any help, explanations, or links to good examples or
> tutorials of using forms, other than the introductory django tutorial.
> Thanks in advance for the help.

You can take a look at djangobook:http://www.djangobook.com/en/2.0/chapter07/--
Łukasz Rekucki

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 13th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support