Commit Graph

16 Commits

Author SHA1 Message Date
Jeremy Stretch a7be755e01 Closes #21712: Support description annotations for static choice form fields 2026-07-02 13:46:43 -04:00
Martin Hauser b6bdfbd2a5
Closes #19821: Consolidate GFK form handling with GenericObjectChoiceField (#22537)
* refactor(forms): Add GenericObjectChoiceField

Replace separate scope_type/scope and parent_object_type/parent field
pairs with unified GenericObjectChoiceField. Introduce
GenericObjectFormMixin to handle GFK descriptor initialization and
assignment.

This removes redundant HTMX/queryset setup logic from ScopedForm,
VLANGroupForm, and ServiceForm by delegating GFK presentation to a
single reusable field and mixin pair. Field query param references now
use `$scope_object_id` instead of `$scope` to match the subwidget name.

Fixes #19821

* fix(forms): Skip validation on HTMX bulk-edit dependent field refresh

Render bulk-edit form unbound when an HTMX request changes a dependent
field (e.g. content type) without clicking Apply. This prevents
validation errors from surfacing before the user submits.

Cache ContentType lookups in GenericObjectChoiceField and sync widget
references before setting queryset to ensure choices land on the
rendered subwidget.

* fix(ipam): Update scope query params for GenericObjectChoiceField

Change available-prefix Add links to use `scope_content_type` and
`scope_object_id` query parameters instead of `scope_type` and `scope`.
This aligns with the GenericObjectChoiceField subwidget naming
introduced in the earlier refactor.

* refactor(models): Simplify GFK handling in clone_fields

Replace `scope_type`/`scope_id` pairs with bare `scope` GFK names in
clone_fields across models. Update CloningMixin to emit GFK subwidget
parameters (`scope_content_type`, `scope_object_id`) directly when a
GenericForeignKey appears in clone_fields.

* Update pre-populated links

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2026-06-29 16:44:33 -04:00
Jeremy Stretch f56015e03d
Closes #13182: Support PrimaryModel and OrganizationalModel in plugins (#20919) 2025-12-09 13:17:21 -08:00
Arthur 360f3bc01b 16284 fix plugin forms doc 2024-05-28 09:07:32 -04:00
Jeremy Stretch 89150f4b27 Add form rendering utilities to plugins dev docs 2024-03-19 13:34:13 -04:00
jeremystretch 02db0bcc2e Closes #11766: Remove obsolete custom ChoiceField and MultipleChoiceField classes 2023-05-12 16:27:50 -04:00
Jeremy Stretch d470848b29
Closes #12246: General cleanup of utilities modules
* Clean up base modules

* Clean up forms modules

* Clean up templatetags modules

* Replace custom simplify_decimal filter with floatformat

* Misc cleanup

* Merge ReturnURLForm into ConfirmationForm

* Clean up import statements for utilities.forms

* Fix field class references in docs
2023-04-14 10:33:53 -04:00
jeremystretch 402d5d955f Documentation cleanup 2023-03-20 16:37:47 -04:00
Jeremy Stretch b9bd96f0c7 Closes #11765: Remove StaticSelect & StaticSelectMultiple (#11767)
* Remove StaticSelect, StaticSelectMultiple form widgets

* Tag custom ChoiceField, MultipleChoiceField classes for removal in v3.6
2023-02-19 20:09:51 -05:00
jeremystretch 23c0ca456f #4347: Rename NetBoxModelCSVForm to NetBoxModelImportForm 2022-11-15 12:24:57 -05:00
Arthur Hanson bb150379a2
10571 replace deprecated mkdoc settings (#10622)
* 10571 replace deprecated mkdoc settings

* Omit landing page from docs nav menu

Co-authored-by: jeremystretch <jstretch@ns1.com>
2022-10-12 08:36:02 -04:00
jeremystretch f72d160249 Add form examples to plugin dev docs 2022-03-23 12:12:31 -04:00
jeremystretch 3dc671395e Introduce local ChoiceField and MultipleChoiceField classes 2022-03-21 15:08:05 -04:00
jeremystretch 28f7b411ed Revise plugins documentation 2022-03-08 15:44:35 -05:00
jeremystretch cf3ca5a661 Refactor & document supported form fields 2022-01-31 14:10:13 -05:00
jeremystretch f4776731ec Establish 4 core forms in netbox.forms.base 2022-01-28 15:48:15 -05:00