Development/AdvancedObjectList
Development / AdvancedObjectLista few development notes for a "generic object list" which should make it easy to create advanced feature-rich lists - including sorting, filtering, adding/removing columns, etc.
1. basics
the generic object list should be able to list any type of model - given a queryset or other iterable object.
implementors can configure different types of columns - dynamically. users can then configure which columns they want to see and which should be used for sorting.
2. terminology
- Column: represents a class which can be used to add a column type to the list
- Column Type:
3. dynamic columns
it must be possible for users to add new columns. - for example a column displaying a given "tag category"
this means that either:
- a column type in a list can be displayed more than once with a different "setting"
- or that users can dynamically add a new column type to the list
4. column configuration
the basic column types are hard coded in python code - just like newforms or models.
all "advanced object lists" and their columns need to be stateless - the user configuration (column config, sorting) is stored in the session (or similar)
an example advanced object list definition could look like:
from sphene.generic import advanced_object_list as objlist
class TaskList(objlist.AdvancedObjectList):
summary = objlist.AttributeColumn('summary', sortcolumn = 'summary')
status = objlist.AttributeColumn('owner')
tagcol = TagCategoryColumn()
an example configuration might look like (this could be python or for example json which is modified by some javascript):
( "summary", "status", { 'column': 'tagcol', 'tagcategory': 'priority' }, )
the following conditions must be met:
- only columns listed in the configuration are displayed
- ... in the order they are configured
- if the config value is a dictionary the values must be passed 1:1 to the column who's name is defined in 'column'
-
if the config value is a list it should be considered nested columns (two values in one column)
- another implementation possibility would be to create a 'MultiValueColumn' and pass a dict value to it configuring "sub columns" .. but i think mult-value columns should be integrated right into the 'advanced object list'.
Last Modified: 2008-04-19 23:34:27 by Herbert Poul - [ Snip Changes ] [ Wiki History ]
0 Comments
No comments yet.
Please login to create a new thread.