forms.Form makes front-end widgets and some validation logic. models.Model
defines a database interface and wraps it in a Python class. The two have
nothing to do with each other aside from vaguely similar APIs for defining
the classes.

The intersection of the two is forms.ModelForm, which uses a model to
populate form fields.

GET vs POST is a functionality difference. GET should be used where the
request could be repeated multiple times and get the same response. POST
should be used where a request has meaningful side effects. (If you're
saving things to a model from a user perspective, you almost certainly want
POST.) There's middle ground between the two where it's a bit of a matter
of opinion, but those are the broad strokes.

On Sun, Aug 14, 2016 at 2:04 PM, Andrew Emory <a.c.em...@gmail.com> wrote:

> Would someone explain to me when you would choose one class over the
> other? Does forms.Form not create a database? Can't you just render
> models.Model as a form?
>
>
> I understand forms.ModelForm is a helper class for creating a form from a
> model. But I still don't really understand why you would choose one over
> the other, like when?
>
>
> Are forms.Form more for GET requests? And the others are POST?
>
>
> Most of what I am trying to do is serve some forms, have the user POST
> some data, and then query the database.
>
>
> Thanks guys.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0db5cf5f-23d2-43c1-8d1c-87ce5eab7efe%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0db5cf5f-23d2-43c1-8d1c-87ce5eab7efe%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYUvnf1p-GCa%3DyrHUfGLORQeSDeBbBnUaDCrvdyEPR5wCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to