kopia lustrzana https://github.com/wagtail/wagtail
Make nested list render as a nested list (#8516)
rodzic
74ed301562
commit
399a34bc93
|
@ -69,9 +69,9 @@ A view performs the following steps to render a model form through the panels me
|
|||
* The top-level panel object for the model is retrieved. Usually this is done by looking up the model's `edit_handler` property and falling back on an `ObjectList` consisting of children given by the model's `panels` property. However, it may come from elsewhere - for example, the ModelAdmin module allows defining it on the ModelAdmin configuration object.
|
||||
* The view calls `bind_to_model` on the top-level panel, passing the model class, and this returns a clone of the panel with a `model` property. As part of this process the `on_model_bound` method is invoked on each child panel, to allow it to perform additional initialisation that requires access to the model (for example, this is where `FieldPanel` retrieves the model field definition).
|
||||
* The view then calls `get_form_class` on the top-level panel to retrieve a ModelForm subclass that can be used to edit the model. This proceeds as follows:
|
||||
** Retrieve a base form class from the model's `base_form_class` property, falling back on `wagtail.admin.forms.WagtailAdminModelForm`
|
||||
** Call `get_form_options` on each child panel - which returns a dictionary of properties including `fields` and `widgets` - and merge the results into a single dictionary
|
||||
** Construct a subclass of the base form class, with the options dict forming the attributes of the inner `Meta` class.
|
||||
- Retrieve a base form class from the model's `base_form_class` property, falling back on `wagtail.admin.forms.WagtailAdminModelForm`
|
||||
- Call `get_form_options` on each child panel - which returns a dictionary of properties including `fields` and `widgets` - and merge the results into a single dictionary
|
||||
- Construct a subclass of the base form class, with the options dict forming the attributes of the inner `Meta` class.
|
||||
* An instance of the form class is created as per a normal Django form view.
|
||||
* The view then calls `get_bound_panel` on the top-level panel, passing `instance`, `form` and `request` as keyword arguments. This returns a `BoundPanel` object, which follows [the template component API](/extending/template_components). Finally, the `BoundPanel` object (and its media definition) is rendered onto the template.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue