wiki:S3/Context

Context

A context is a way of defining a filter for a resource by it's links to another resource.

We access the filters via a common FieldSelector despite the back-end ther actual linkages varying from being as simple as a foreign key or going through a link table:

The context filters are usually defined in the core models (modules/s3db/*.py), like:

s3db.configure("project_project",
               context = {"location": "location.location_id",
                          "organisation": "organisation_id",
                          },
               )

This shows that:

  • if we want "All Projects related to Organisation X" then the back-end will do this by using the simple Foreign Key 'organisation_id', although we can access that via (organisation).
  • if we want "All projects related to location Y" then the back-end will do this through the 'location' Component, although we can access that via (location).

Contexts get used a lot by Profile pages.

Last modified 11 years ago Last modified on 06/13/14 11:54:59
Note: See TracWiki for help on using the wiki.