August 2016
Beginner to intermediate
717 pages
15h 24m
English
The HttpRequest object contains useful information about the current user, language, server variables, cookies, session, and so on. As a matter of fact, HttpRequest is provided in the views and middlewares, and then you can pass it or its attribute values to forms, model methods, model managers, templates, and so on. To make life easier, you can use the ThreadLocalMiddleware middleware that stores the current HttpRequest object in the globally-accessed Python thread. Therefore, you can access it from model methods, forms, signal handlers, and any other place that didn't have direct access to the HttpRequest object previously. In this recipe, we will define this middleware.
Create the utils app and put it ...
Read now
Unlock full access