web/facet.py
branchstable
changeset 7860 ee233d5365b4
parent 7851 54e6abed520a
child 7874 be04706eacc9
equal deleted inserted replaced
7858:f91255a3b2c2 7860:ee233d5365b4
   989     .. sourcecode:: python
   989     .. sourcecode:: python
   990 
   990 
   991       class AgencyFacet(RQLPathFacet):
   991       class AgencyFacet(RQLPathFacet):
   992           __regid__ = 'agency'
   992           __regid__ = 'agency'
   993           # this facet should only be selected when visualizing offices
   993           # this facet should only be selected when visualizing offices
   994           __select__ = RelationFacet.__select__ & is_instance('Office')
   994           __select__ = is_instance('Office')
   995           # this facet is a filter on the 'Agency' entities linked to the office
   995           # this facet is a filter on the 'Agency' entities linked to the office
   996           # through the 'proposed_by' relation, where the office is the subject
   996           # through the 'proposed_by' relation, where the office is the subject
   997           # of the relation
   997           # of the relation
   998           path = ['X has_address O', 'O name N']
   998           path = ['X has_address O', 'O name N']
   999           filter_variable = 'O'
   999           filter_variable = 'O'
  1000           label_variable = 'N'
  1000           label_variable = 'N'
  1001 
  1001 
  1002       class PostalCodeFacet(RQLPathFacet):
  1002       class PostalCodeFacet(RQLPathFacet):
  1003           __regid__ = 'postalcode'
  1003           __regid__ = 'postalcode'
  1004           # this facet should only be selected when visualizing offices
  1004           # this facet should only be selected when visualizing offices
  1005           __select__ = RelationAttributeFacet.__select__ & is_instance('Office')
  1005           __select__ = is_instance('Office')
  1006           # this facet is a filter on the PostalAddress entities linked to the
  1006           # this facet is a filter on the PostalAddress entities linked to the
  1007           # office through the 'has_address' relation, where the office is the
  1007           # office through the 'has_address' relation, where the office is the
  1008           # subject of the relation
  1008           # subject of the relation
  1009           path = ['X has_address O', 'O postal_code PC']
  1009           path = ['X has_address O', 'O postal_code PC']
  1010           filter_variable = 'PC'
  1010           filter_variable = 'PC'