Extend fieldsets
to support rendering complex form layouts
#14739
Labels
status: accepted
This issue has been accepted for implementation
type: feature
Introduction of new functionality to the application
Milestone
NetBox version
v3.7.0
Feature type
New functionality
Proposed functionality
Introduce several new classes that would enable more complex form rendering via the
fieldsets
attribute on a form. For example, the following is defined onSiteForm.Meta
:This causes the form to render three discrete groups of fields with the assigned headings:
This proposal seeks to extend this ability by enabling several forms of more complex rendering, detailed below.
Static Attribute Rendering
Display an object attribute (not necessarily a form field) of an existing object, rendered as a read-only field.
Side-by-Side Fields
Display several fields inline on a single row within the form.
Tabbed Groups
Allow fields to be arranged in tabbed subgroups. Selecting the tab for a group will display its fields and hide fields from its peers.
Use case
There are several instances across NetBox where we use custom HTML templates to render object edit forms, because we need to deviate from the standard form rendering and accommodate a more complex layout. Some instances include:
Moving this logic into the form fieldset definitions will allow us to ditch most of our custom templates.
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: