container¶
Container classes are classes that are used to transport data between the model thread and the GUI thread.
When complex data sets need to be visualized (eg.: charts, intervals), built-in python types don’t contain enough information, while dictionary like structures are not self documented. Hence the need of specialized container classes to transport this data between the model and the GUI.
To use this classes :
- On your model class, define properties returning a container class
- In the admin class, add the property to the list of fields to visualize, and specify its delegate
eg:
class MyEntity(Entity):
@property def my_interval(self):
return IntervalsContainer()
- class Admin(EntityAdmin):
- form_display = [‘my_interval’] field_attributes = dict(my_interval=dict(delegate=IntervalsDelegate))