Context and domain
Context and domain are two widely used concepts which we have encountered several times in the previous chapters. We have seen them being used in the backend, in model fields and methods, and in the frontend, in windows actions and forms.
We will now take a closer look at them, to see when and how they should be used.
Context data
The context is dictionary-carrying session data that can be used on both the client-side user interface and the server-side ORM and business logic.
On the client side it can carry information from one view to the next, such as the ID of the record active on the previous view, after following a link or a button, or to provide default values to be used in the next view.
On the server side, some recordset field values can depend on the locale settings provided by the context. In particular, thelang
key affects the value of translatable fields. Context can also provide signals for server-side code. For example, theactive_test
key, when set toFalse
, changes...