Development/AdvancedObjectList
Development / AdvancedObjectListBack to Snip <-- Previous Change | Next Change -->
| Diff Summary | |||||
|---|---|---|---|---|---|
| Title | |||||
| Date | 2008-04-17 07:02:05 | 2008-04-19 23:32:05 | |||
| Editor | Herbert Poul | Herbert Poul | |||
| Tags | |||||
| 2008-04-17 07:02:05 by Herbert Poul | 2008-04-19 23:32:05 by Herbert Poul | ||||
|---|---|---|---|---|---|
| 21 | this means that either: | 21 | this means that either: | ||
| 22 | 22 | ||||
| 23 | - a column type in a list can be displayed more th | 23 | - a column type in a list can be displayed more th | ||
| > | an once with a different "setting" | > | an once with a different "setting" | ||
| 24 | - or that users can dynamically add a new column t | 24 | - or that users can dynamically add a new column t | ||
| > | ype to the list | > | ype to the list | ||
| 25 | 25 | ||||
| t | t | 26 | |||
| 27 | # column configuration | ||||
| 28 | |||||
| 29 | the basic column types are hard coded in python co | ||||
| > | de - just like newforms or models. | ||||
| 30 | |||||
| 31 | all "advanced object lists" and their columns need | ||||
| > | to be stateless - the user configuration (column | ||||
| > | config, sorting) is stored in the session (or simi | ||||
| > | lar) | ||||
| 32 | |||||
| 33 | an example advanced object list definition could l | ||||
| > | ook like: | ||||
| 34 | |||||
| 35 | from sphene.generic import advanced_object_lis | ||||
| > | t as objlist | ||||
| 36 | class TaskList(objlist.AdvancedObjectList): | ||||
| 37 | summary = objlist.AttributeColumn('summary | ||||
| > | ', sortcolumn = 'summary') | ||||
| 38 | status = objlist.AttributeColumn('owner') | ||||
| 39 | tagcol = TagCategoryColumn() | ||||
| 40 | |||||
| 41 | an example configuration (json encoded) might look | ||||
| > | like: | ||||
| 42 | |||||
| 43 | ( "summary", "status", { 'column': 'tagcol', ' | ||||
| > | tagcategory': 'priority' }, ) | ||||
| 44 | |||||
| 45 | the following conditions must be met: | ||||
| 46 | |||||
| 47 | - only columns listed in the configuration are | ||||
| > | displayed | ||||
| 48 | - ... in the order they are configured | ||||
| 49 | - if the config value is a dictionary the valu | ||||
| > | es must be passed 1:1 to the column who's name is | ||||
| > | defined in 'column' | ||||
| 50 | - if the config value is a list it should be c | ||||
| > | onsidered nested columns (two values in one column | ||||
| > | ) | ||||
| 51 | - another implementation possibility would | ||||
| > | be to create a 'MultiValueColumn' and pass a dict | ||||
| > | value to it configuring "sub columns" .. but i th | ||||
| > | ink mult-value columns should be integrated right | ||||
| > | into the 'advanced object list'. | ||||
Powered by Sphene Community Tools
