A view is a callable which takes a request and returns a response. This can be more than just a function, and Django provides an example of some classess wich can be used as views.These allow you to structure your views and reuse code by harnessing inheritance and mixins.
Django provides base view classes which will suite a wide range of applications. All views inherit from the View class, which handles linking the view in to the URLs, HTTP method dispatching and other simple features. RedirectView is for a simple HTTP redirect , and TemplateView extends the base class to make it also render a template.
The simplest way to use generic views is to create them directly in your URLConf. If you are only changing a few simple attribiutes on a class-based view, you can simply pass them into the as_view() method. Any arguments passed to as_view() will override attribute sets on the class.
The second, more powerful way to use generic views is to inherit from an existing view and override attributes or methods in your subclassess to provide new values or methods.
django.form is Django's form-handling library. Whiel it is possible to process form submission just using Django's HTTPReuquest class, using the form library takes care of a number of common form-related tasks.
The library is decoupled from the other Django components, such as the database layer, views and templates. Form classess are created as subclassess of django.forms.Form and make use of a declarative style that you will be familiar with if you have used Django's database models;
Django provides base view classes which will suite a wide range of applications. All views inherit from the View class, which handles linking the view in to the URLs, HTTP method dispatching and other simple features. RedirectView is for a simple HTTP redirect , and TemplateView extends the base class to make it also render a template.
The simplest way to use generic views is to create them directly in your URLConf. If you are only changing a few simple attribiutes on a class-based view, you can simply pass them into the as_view() method. Any arguments passed to as_view() will override attribute sets on the class.
The second, more powerful way to use generic views is to inherit from an existing view and override attributes or methods in your subclassess to provide new values or methods.
django.form is Django's form-handling library. Whiel it is possible to process form submission just using Django's HTTPReuquest class, using the form library takes care of a number of common form-related tasks.
The library is decoupled from the other Django components, such as the database layer, views and templates. Form classess are created as subclassess of django.forms.Form and make use of a declarative style that you will be familiar with if you have used Django's database models;