Changes between Initial Version and Version 1 of S3/Context


Ignore:
Timestamp:
05/12/14 11:23:03 (11 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/Context

    v1 v1  
     1= Context =
     2
     3A context is a way of defining a filter for a resource by it's links to another resource.
     4
     5We access the filters via a common [wiki:S3/FieldSelectors FieldSelector] despite the back-end ther actual linkages varying from being as simple as a foreign key or going through a link table:
     6 * [wiki:S3/FieldSelectors#ContextPaths]
     7
     8The context filters are usually defined in the core models ({{{modules/s3db/*.py}}}), like:
     9{{{
     10s3db.configure("project_project",
     11               context = {"location": "location.location_id",
     12                          "organisation": "organisation_id",
     13                          },
     14               )
     15}}}
     16
     17This shows that:
     18* 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)}}}.
     19* if we want "All projects related to location Y" then the back-end will do this through the 'location' [wiki:S3/S3Model/ComponentResources Component], although we can access that via {{{(location)}}}.
     20
     21Contexts get used a lot by [wiki:S3Profile Profile pages].