ModelList class
This class makes easier the job of rendering lists of model instances in django templates. It's intended to mimic the behavior of the Model Forms in that it contains the code needed to render it as an HTML table and makes it easy to handle all the model lists from a single view (as it's usually done with the generic views for creating and updating model instances). It also supports pagination and provides hooks for subclassing and customizing the rendered fields, column titles and list order. Basic example: `class Account(Model):` `name = models.CharField(max_length=MAX_LENGTH)` `responsible = models.CharField(max_length=MAX_LENGTH)` `email = models.EmailField()` `class AccountModelList(ModelList):` `class Meta:` `model = Account` `fields = ['name', 'responsible'] #email won't get a column` The model list would be instantiated with something like: `model_list = AccountModelList(instances=account_queryset)` Then a table header can be rendered with model_list.as_table_header(), while the table rows can be rendered calling as_table() on each model_list.items element.
- model
- pagination
- table
- list
- model list
- order by
- render table