doc/book/en/development/devweb/facets.rst
changeset 4446 a413fac5ff5e
parent 4437 21f2e01fdd6a
child 4751 1a9d2c3c7f0c
equal deleted inserted replaced
4445:ef623f05e5e2 4446:a413fac5ff5e
   109 .. sourcecode:: python
   109 .. sourcecode:: python
   110 
   110 
   111     class CompositionDateFacet(DateRangeFacet):
   111     class CompositionDateFacet(DateRangeFacet):
   112         # 1. make sure this facet is displayed only on Track selection
   112         # 1. make sure this facet is displayed only on Track selection
   113         __select__ = DateRangeFacet.__select__ & implements('Track')
   113         __select__ = DateRangeFacet.__select__ & implements('Track')
   114         # 2. give the facet an id ._cwuired by CubicWeb)
   114         # 2. give the facet an id required by CubicWeb)
   115         id = 'compdate-facet'
   115         id = 'compdate-facet'
   116         # 3. specify the attribute name that actually stores the date in the DB
   116         # 3. specify the attribute name that actually stores the date in the DB
   117         rtype = 'composition_date'
   117         rtype = 'composition_date'
   118 
   118 
   119 And that's it, on each page displaying tracks, you'll be able to filter them
   119 And that's it, on each page displaying tracks, you'll be able to filter them