November 2015
Beginner to intermediate
840 pages
26h 30m
English
FlatPage Objects via MiddlewareAs discussed in Chapter 9 and Chapter 12, middleware is a class that modifies HttpRequest and HttpResponse objects. These classes receive the HttpRequest before it reaches the view, and then receive the HttpResponse that the view has created, as shown in Figure 15.1. The set of middleware classes receive the HttpResponse objects in the reverse order from HttpRequest objects: the first class to receive the HttpRequest will be the last to receive the HttpResponse object. The utility of middleware is that it allows information to be added to every webpage (this is how the cross-site request forgery [CSRF] token works).
Figure 15.1: MVC Diagram with Middleware
Prior to Django 1.4, the flatpages ...
Read now
Unlock full access