-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated doc for default context processors in Guides section
- Loading branch information
1 parent
2969fcf
commit 4dd6806
Showing
1 changed file
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
## Default context Processors | ||
## Default context processors | ||
|
||
### settings | ||
all settings are copied into the context of the template | ||
Context processors are part of the Django template language. The context processor is applied *after* the context for a given request. In Opal we use this to give all templates access to some generic information about the internals of Opal applications. | ||
|
||
## models | ||
all subrecords are copied into the context of the template under the namespace models, e.g. the allergies subrecord can be referred to by models.Allergy | ||
### Settings | ||
All Opal settings are copied into the context of the template. | ||
|
||
### Models | ||
All [subrecords](../reference/subrecords/) (the underlying clinical models of Opal) are copied into the context of the template under the namespace `models`, e.g. the Allergies subrecord can be referred to by `models.Allergy` | ||
|
||
### Pathways | ||
Pathways are copied in to the context of the template under the namespace `pathways`. For an example Pathway you would be able to access attributes of a Pathway thus: `pathways.MyPathway.get_display_name` | ||
|
||
It is important to note that since the context processor is applied *after* the request context, this can lead to the context processor over-writing elements of context data. For further information on this see the Django documentation. |