Skip to content

Commit

Permalink
updated doc for default context processors in Guides section
Browse files Browse the repository at this point in the history
  • Loading branch information
pacharanero committed Dec 5, 2017
1 parent 2969fcf commit 4dd6806
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions doc/docs/guides/context_processors.md
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.

0 comments on commit 4dd6806

Please sign in to comment.