218 .. _DefineViews: |
222 .. _DefineViews: |
219 |
223 |
220 Define your entities views |
224 Define your entities views |
221 -------------------------- |
225 -------------------------- |
222 |
226 |
|
227 Each entity defined in a model inherits defaults views allowing |
|
228 different rendering of the data. You can redefine each of them |
|
229 according to your needs and preferences. If you feel like it then |
|
230 you have to know how a view is defined. |
|
231 |
|
232 |
223 The views selection principle |
233 The views selection principle |
224 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
234 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
225 |
235 |
226 A view is defined by a Python class which includes: |
236 A view is defined by a Python class which includes: |
227 |
237 |
228 - an identifier (all objects in `CubicWeb` are entered in a registry |
238 - an identifier (all objects in `CubicWeb` are entered in a registry |
229 and this identifier will be used as a key) |
239 and this identifier will be used as a key) |
230 |
240 |
231 - a filter to select the resulsets it can be applied to |
241 - a filter to select the resulsets it can be applied to |
232 |
242 |
|
243 A view has a set of methods complying |
|
244 with the `View` class interface (`cubicweb.common.view`). |
233 |
245 |
234 `CubicWeb` provides a lot of standard views for the type |
246 `CubicWeb` provides a lot of standard views for the type |
235 `EntityView`, for a complete list, you |
247 `EntityView`, for a complete list, you |
236 will have to read the code in directory ``cubicweb/web/views/`` |
248 will have to read the code in directory ``cubicweb/web/views/`` |
237 |
249 |