Django Forms

Information About Submitted Data

HttpRequest objects have two attributes that contain information submitted by the user: request.GET and request.POST.

POST data generally is submitted from an HTML <form>, while GET data can come from a <form> or the query string in the page’s URL.

Use POST whenever the act of submitting the form will have some side effect — changing data, or sending an e-mail, or something else that’s beyond simple display of data.

Form Class

Django comes with a form library, called django.forms

from django import forms
class ContactForm(forms.Form):
    subject = forms.CharField()
    email = forms.EmailField(required=False)
    message = forms.CharField()
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.