|
@@ -24,7 +24,7 @@ Next you define your own views inheriting from your mixin and base views. Misago
|
|
|
|
|
|
Base class for admin mixins that contain properties and behaviours shared between admin views. While you are allowed to set any properties and function on your own mixins to dry your admin views more, bare minimum expected from you is following:
|
|
Base class for admin mixins that contain properties and behaviours shared between admin views. While you are allowed to set any properties and function on your own mixins to dry your admin views more, bare minimum expected from you is following:
|
|
|
|
|
|
-* `Model` property or `get_model(self)` method to get model type.
|
|
|
|
|
|
+* `model` property or `get_model(self)` method to get model type.
|
|
* `root_link` property that is string with link name for "index" view for admin actions (usually link to items list).
|
|
* `root_link` property that is string with link name for "index" view for admin actions (usually link to items list).
|
|
* `templates_dir` property being string with name of directory with admin templates used by mixin views.
|
|
* `templates_dir` property being string with name of directory with admin templates used by mixin views.
|
|
|
|
|
|
@@ -37,7 +37,7 @@ Base class for lists if items. Supports following properties:
|
|
|
|
|
|
* `template` - name of template file located in `templates_dir` used to render this view. Defaults to `list.html`
|
|
* `template` - name of template file located in `templates_dir` used to render this view. Defaults to `list.html`
|
|
* `items_per_page` - integer controlling number of items displayed on single page. Defaults to 0 which means no pagination
|
|
* `items_per_page` - integer controlling number of items displayed on single page. Defaults to 0 which means no pagination
|
|
-* `SearchForm` - Form type used to construct form for filtering this list. Either this field or `get_search_form` method is required to make list searchable.
|
|
|
|
|
|
+* `search_form` - Form type used to construct form for filtering this list. Either this field or `get_search_form` method is required to make list searchable.
|
|
* `ordering` - list of supported sorting methods. List of tuples. Each tuple should countain two items: name of ordering method (eg. "Usernames, descending") and `order_by` argument (`-username`). Defaults to none which means queryset will not be ordered. If contains only one element, queryset is ordered, but option for changing ordering method is not displayed.
|
|
* `ordering` - list of supported sorting methods. List of tuples. Each tuple should countain two items: name of ordering method (eg. "Usernames, descending") and `order_by` argument (`-username`). Defaults to none which means queryset will not be ordered. If contains only one element, queryset is ordered, but option for changing ordering method is not displayed.
|
|
* `mass_actions` - list of dicts defining list's mass actions. Each dict should have `action` key that will be used to identify method to call, `name` for displayed name, `icon` for icon and optional `confirmation` message. Actions can define optional "is_atomic" key to control if they should be wrapped in transaction or not. This is default behaviour for mass actions.
|
|
* `mass_actions` - list of dicts defining list's mass actions. Each dict should have `action` key that will be used to identify method to call, `name` for displayed name, `icon` for icon and optional `confirmation` message. Actions can define optional "is_atomic" key to control if they should be wrapped in transaction or not. This is default behaviour for mass actions.
|
|
* `selection_label` - Label displayed on mass action button if there are items selected. `0` will be replaced with number of selected items automatically.
|
|
* `selection_label` - Label displayed on mass action button if there are items selected. `0` will be replaced with number of selected items automatically.
|
|
@@ -85,12 +85,12 @@ If you add custom mass action to view, besides adding new entry to `mass_actions
|
|
Base class for forms views.
|
|
Base class for forms views.
|
|
|
|
|
|
* `template` - name of template file located in `templates_dir` used to render this view. Defaults to `form.html`
|
|
* `template` - name of template file located in `templates_dir` used to render this view. Defaults to `form.html`
|
|
-* `Form` property or **create_form_type** method - `create_form` method is called with `request` as its argument and is expected to return form type that will be used by view. If you need to build form type dynamically, instead of defining `Form` property, define your own `create_form`.
|
|
|
|
|
|
+* `form` property or **create_form_type** method - `create_form` method is called with `request` as its argument and is expected to return form type that will be used by view. If you need to build form type dynamically, instead of defining `form` property, define your own `create_form`.
|
|
|
|
|
|
|
|
|
|
#### `create_form_type(self, request)`
|
|
#### `create_form_type(self, request)`
|
|
|
|
|
|
-Returns form type that will be used to create form instance. By default returns value of `Form` property.
|
|
|
|
|
|
+Returns form type that will be used to create form instance. By default returns value of `form` property.
|
|
|
|
|
|
|
|
|
|
#### `initialize_form(self, FormType, request)`
|
|
#### `initialize_form(self, FormType, request)`
|