nautobot.apps.forms
¶
Forms and fields for apps to use.
nautobot.apps.forms.APISelect
¶
Bases: SelectWithDisabled
A select widget populated via an API call
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url |
str
|
API endpoint URL. Required if not set automatically by the parent field. |
None
|
api_version |
str
|
API version. |
None
|
Source code in nautobot/core/forms/widgets.py
add_query_param(name, value)
¶
Add details for an additional query param in the form of a data-* JSON-encoded list attribute.
:param name: The name of the query param :param value: The value of the query param
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.AddressFieldMixin
¶
Bases: forms.ModelForm
ModelForm mixin for IPAddress based models.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.BootstrapMixin
¶
Bases: forms.BaseForm
Add the base Bootstrap CSS classes to form elements.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.BulkEditForm
¶
Bases: forms.Form
Base form for editing multiple objects in bulk.
Note that for models supporting custom fields and relationships, nautobot.extras.forms.NautobotBulkEditForm is a more powerful subclass and should be used instead of directly inheriting from this class.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.BulkEditNullBooleanSelect
¶
Bases: forms.NullBooleanSelect
A Select widget for NullBooleanFields
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.BulkRenameForm
¶
Bases: forms.Form
An extendable form to be used for renaming objects in bulk.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.CSVChoiceField
¶
Bases: django_forms.ChoiceField
Invert the provided set of choices to take the human-friendly label as input, and return the database value.
Despite the name, this is no longer used in CSV imports since 2.0, but is used in JSON/YAML import of DeviceTypes.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.CSVContentTypeField
¶
Bases: CSVModelChoiceField
Reference a ContentType in the form {app_label}.{model}
.
Note: class name is misleading; this field is also used in numerous FilterSets where it has nothing to do with CSV.
Source code in nautobot/core/forms/fields.py
prepare_value(value)
¶
Allow this field to support {app_label}.{model}
style, null values, or PK-based lookups
depending on how the field is used.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.CSVDataField
¶
Bases: django_forms.CharField
A CharField (rendered as a Textarea) which expects CSV-formatted data.
Initial value is a list of headers corresponding to the required fields for the given serializer class.
This no longer actually does any CSV parsing or validation on its own, as that is now handled by the NautobotCSVParser class and the REST API serializers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
required_field_names |
list[str]
|
List of field names representing required fields for this import. |
''
|
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.CSVFileField
¶
Bases: django_forms.FileField
A FileField (rendered as a ClearableFileInput) which expects a file containing CSV-formatted data.
This no longer actually does any CSV parsing or validation on its own, as that is now handled by the NautobotCSVParser class and the REST API serializers.
Source code in nautobot/core/forms/fields.py
to_python(file)
¶
For parity with CSVDataField, this returns the CSV text rather than an UploadedFile object.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.CSVModelChoiceField
¶
Bases: django_forms.ModelChoiceField
Provides additional validation for model choices entered as CSV data.
Note: class name is misleading; the subclass CSVContentTypeField (below) is also used in FilterSets, where it has nothing to do with CSV data.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.CSVModelForm
¶
Bases: forms.ModelForm
ModelForm used for the import of objects.
Note: the name is misleading as since 2.0 this is no longer used for CSV imports; however it is still used for JSON/YAML imports of DeviceTypes and their component templates.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.CSVMultipleChoiceField
¶
Bases: CSVChoiceField
A version of CSVChoiceField that supports and emits a list of choice values.
As with CSVChoiceField, the name is misleading, as this is no longer used for CSV imports, but is used for JSON/YAML import of DeviceTypes still.
Source code in nautobot/core/forms/fields.py
to_python(value)
¶
nautobot.apps.forms.CSVMultipleContentTypeField
¶
Bases: MultipleContentTypeField
Reference a list of ContentType
objects in the form `{app_label}.{model}'.
Note: This is unused in Nautobot core at this time, but some apps (data-validation-engine) use this for non-CSV purposes, similar to CSVContentTypeField above.
Source code in nautobot/core/forms/fields.py
prepare_value(value)
¶
Parse a comma-separated string of model names into a list of PKs.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.ColorSelect
¶
Bases: forms.Select
Extends the built-in Select widget to colorize each
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.CommentField
¶
Bases: django_forms.CharField
A textarea with support for Markdown rendering. Exists mostly just to add a standard help_text.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.ConfirmationForm
¶
Bases: BootstrapMixin
, ReturnURLForm
A generic confirmation form. The form is not valid unless the confirm field is checked.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.ContentTypeSelect
¶
Bases: StaticSelect2
Appends an api-value
attribute equal to the slugified model name for each ContentType. For example:
This attribute can be used to reference the relevant API endpoint for a particular ContentType.
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.CustomFieldModelCSVForm
¶
Bases: CSVModelForm
, CustomFieldModelFormMixin
Base class for CSV/JSON/YAML import of models that support custom fields.
TODO: The class name is a misnomer; as of 2.0 this class is not used for any CSV imports, as that's now handled by the REST API. However it is still used when importing component-templates as part of a JSON/YAML DeviceType import.
Source code in nautobot/extras/forms/forms.py
nautobot.apps.forms.CustomFieldModelFormMixin
¶
Bases: forms.ModelForm
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.DatePicker
¶
Bases: forms.TextInput
Date picker using Flatpickr.
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.DateTimePicker
¶
Bases: forms.TextInput
DateTime picker using Flatpickr.
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.DynamicFilterForm
¶
Bases: BootstrapMixin
, forms.Form
Form for dynamically inputting filter values for an object list.
Source code in nautobot/core/forms/forms.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
__init__(*args, filterset=None, **kwargs)
¶
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.DynamicModelChoiceField
¶
Bases: DynamicModelChoiceMixin
, django_forms.ModelChoiceField
Override get_bound_field() to avoid pre-populating field choices with a SQL query. The field will be rendered only with choices set via bound data. Choices are populated on-demand via the APISelect widget.
Source code in nautobot/core/forms/fields.py
clean(value)
¶
When null option is enabled and "None" is sent as part of a form to be submitted, it is sent as the string 'null'. This will check for that condition and gracefully handle the conversion to a NoneType.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.DynamicModelChoiceMixin
¶
:param display_field: The name of the attribute of an API response object to display in the selection list
:param query_params: A dictionary of additional key/value pairs to attach to the API request
:param initial_params: A dictionary of child field references to use for selecting a parent field's initial value
:param null_option: The string used to represent a null selection (if any)
:param disabled_indicator: The name of the field which, if populated, will disable selection of the
choice (optional)
:param depth: Nested serialization depth when making API requests (default: 0
or a flat representation)
Source code in nautobot/core/forms/fields.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
|
prepare_value(value)
¶
Augment the behavior of forms.ModelChoiceField.prepare_value().
Specifically, if value
is a PK, but we have to_field_name
set, we need to look up the model instance
from the given PK, so that the base class will get the appropriate field value rather than just keeping the PK,
because the rendered form field needs this in order to correctly prepopulate a default selection.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.DynamicModelMultipleChoiceField
¶
Bases: DynamicModelChoiceMixin
, django_forms.ModelMultipleChoiceField
A multiple-choice version of DynamicModelChoiceField.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.ExpandableIPAddressField
¶
Bases: django_forms.CharField
A field which allows for expansion of IP address ranges Example: '192.0.2.[1-254]/24' => ['192.0.2.1/24', '192.0.2.2/24', '192.0.2.3/24' ... '192.0.2.254/24']
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.ExpandableNameField
¶
Bases: django_forms.CharField
A field which allows for numeric range expansion Example: 'Gi0/[1-3]' => ['Gi0/1', 'Gi0/2', 'Gi0/3']
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.ImportForm
¶
Bases: BootstrapMixin
, forms.Form
Generic form for creating an object from JSON/YAML data
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.JSONArrayFormField
¶
Bases: django_forms.JSONField
A FormField counterpart to JSONArrayField.
Replicates ArrayFormField's base field validation: Field values are validated as JSON Arrays,
and each Array element is validated by base_field
validators.
Source code in nautobot/core/forms/fields.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
|
clean(value)
¶
Validate value
and return its "cleaned" value as an appropriate
Python object. Raise ValidationError for any errors.
Source code in nautobot/core/forms/fields.py
has_changed(initial, data)
¶
Return True if data
differs from initial
.
Source code in nautobot/core/forms/fields.py
prepare_value(value)
¶
run_validators(value)
¶
Runs all validators against value
and raise ValidationError if necessary.
Some validators can't be created at field initialization time.
Source code in nautobot/core/forms/fields.py
to_python(value)
¶
Convert value
into JSON, raising django.core.exceptions.ValidationError
if the data can't be converted. Return the converted value.
Source code in nautobot/core/forms/fields.py
validate(value)
¶
Validate value
and raise ValidationError if necessary.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.JSONField
¶
Bases: _JSONField
Custom wrapper around Django's built-in JSONField to avoid presenting "null" as the default text.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.LaxURLField
¶
Bases: django_forms.URLField
Modifies Django's built-in URLField to remove the requirement for fully-qualified domain names (e.g. http://myserver/ is valid)
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.MultiMatchModelMultipleChoiceField
¶
Bases: DynamicModelChoiceMixin
, django_filters.fields.ModelMultipleChoiceField
Filter field to support matching on the PK or to_field_name
fields (defaulting to slug
if not specified).
Raises ValidationError if none of the fields match the requested value.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.MultiValueCharField
¶
Bases: django_forms.CharField
CharField that takes multiple user character inputs and render them as tags in the form field. Press enter to complete an input.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.MultiValueCharInput
¶
Bases: StaticSelect2Multiple
Manual text input with tagging enabled. Press enter to create a new entry.
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.MultipleContentTypeField
¶
Bases: django_forms.ModelMultipleChoiceField
Field for choosing any number of ContentType
objects.
Optionally can restrict the available ContentTypes to those supporting a particular feature only.
Optionally can pass the selection through as a list of {app_label}.{model}
strings instead of PK values.
Source code in nautobot/core/forms/fields.py
__init__(*args, feature=None, choices_as_strings=False, **kwargs)
¶
Construct a MultipleContentTypeField.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature |
str
|
Feature name to use in constructing a FeatureQuery to restrict the available ContentTypes. |
None
|
choices_as_strings |
bool
|
If True, render selection as a list of |
False
|
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.NautobotBulkEditForm
¶
Bases: BootstrapMixin
, CustomFieldModelBulkEditFormMixin
, RelationshipModelBulkEditFormMixin
, NoteModelBulkEditFormMixin
Base class for bulk-edit forms for models that support relationships, custom fields and notes.
Source code in nautobot/extras/forms/base.py
nautobot.apps.forms.NautobotFilterForm
¶
Bases: BootstrapMixin
, CustomFieldModelFilterFormMixin
, RelationshipModelFilterFormMixin
This class exists to combine common functionality and is used to inherit from throughout the codebase where all three of BootstrapMixin, CustomFieldModelFilterFormMixin and RelationshipModelFilterFormMixin are needed.
Source code in nautobot/extras/forms/base.py
nautobot.apps.forms.NautobotModelForm
¶
Bases: BootstrapMixin
, CustomFieldModelFormMixin
, RelationshipModelFormMixin
, NoteModelFormMixin
This class exists to combine common functionality and is used to inherit from throughout the codebase where all of BootstrapMixin, CustomFieldModelFormMixin, RelationshipModelFormMixin, and NoteModelFormMixin are needed.
Source code in nautobot/extras/forms/base.py
nautobot.apps.forms.NoteFormBase
¶
Bases: forms.Form
Base for the NoteModelFormMixin and NoteModelBulkEditFormMixin.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.NoteModelBulkEditFormMixin
¶
Bases: BulkEditForm
, NoteFormBase
Bulk-edit form mixin for models that support Notes.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.NumericArrayField
¶
Bases: SimpleArrayField
Basic array field that takes comma-separated or hyphenated ranges.
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.PrefixFieldMixin
¶
Bases: forms.ModelForm
ModelForm mixin for IPNetwork based models.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.RelationshipModelBulkEditFormMixin
¶
Bases: BulkEditForm
Bulk-edit form mixin for models that support Relationships.
Source code in nautobot/extras/forms/mixins.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
|
save_relationships(*, instance, nullified_fields)
¶
Helper method to be called from BulkEditView.post().
Source code in nautobot/extras/forms/mixins.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
nautobot.apps.forms.RelationshipModelFilterFormMixin
¶
Bases: forms.Form
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.RelationshipModelFormMixin
¶
Bases: forms.ModelForm
Source code in nautobot/extras/forms/mixins.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
|
clean()
¶
First check for any required relationships errors and if there are any, add them via form field errors. Then verify that any requested RelationshipAssociations do not violate relationship cardinality restrictions.
- For TYPE_ONE_TO_MANY and TYPE_ONE_TO_ONE relations, if the form's object is on the "source" side of the relationship, verify that the requested "destination" object(s) do not already have any existing RelationshipAssociation to a different source object.
- For TYPE_ONE_TO_ONE relations, if the form's object is on the "destination" side of the relationship, verify that the requested "source" object does not have an existing RelationshipAssociation to a different destination object.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.ReturnURLForm
¶
Bases: forms.Form
Provides a hidden return URL field to control where the user is directed after the form is submitted.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.RoleModelBulkEditFormMixin
¶
Bases: forms.Form
Mixin to add non-required role
choice field to forms.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.RoleModelFilterFormMixin
¶
Bases: forms.Form
Mixin to add non-required role
multiple-choice field to filter forms.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.SelectWithDisabled
¶
Bases: forms.Select
Modified the stock Select widget to accept choices using a dict() for a label. The dict for each option must include 'label' (string) and 'disabled' (boolean).
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.SelectWithPK
¶
Bases: StaticSelect2
Include the primary key of each option in the option label (e.g. "Router7 (4721)").
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.SlugField
¶
Bases: django_forms.SlugField
Extend the built-in SlugField to automatically populate from a field called name
unless otherwise specified.
Source code in nautobot/core/forms/fields.py
__init__(slug_source='name', *args, **kwargs)
¶
Instantiate a SlugField.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slug_source |
(str, tuple)
|
Name of the field (or a list of field names) that will be used to suggest a slug. |
'name'
|
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.SlugWidget
¶
Bases: forms.TextInput
Subclass TextInput and add a slug regeneration button next to the form field.
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.SmallTextarea
¶
nautobot.apps.forms.StaticSelect2
¶
nautobot.apps.forms.StatusModelBulkEditFormMixin
¶
Bases: forms.Form
Mixin to add non-required status
choice field to forms.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.StatusModelFilterFormMixin
¶
Bases: forms.Form
Mixin to add non-required status
multiple-choice field to filter forms.
Source code in nautobot/extras/forms/mixins.py
nautobot.apps.forms.TableConfigForm
¶
Bases: BootstrapMixin
, forms.Form
Form for configuring user's table preferences.
Source code in nautobot/core/forms/forms.py
nautobot.apps.forms.TagFilterField
¶
Bases: DynamicModelMultipleChoiceField
A filter field for the tags of a model. Only the tags used by a model are displayed.
:param model: The model of the filter
Source code in nautobot/core/forms/fields.py
__init__(model, *args, query_params=None, queryset=None, **kwargs)
¶
Source code in nautobot/core/forms/fields.py
nautobot.apps.forms.TimePicker
¶
Bases: forms.TextInput
Time picker using Flatpickr.
Source code in nautobot/core/forms/widgets.py
nautobot.apps.forms.add_blank_choice(choices)
¶
nautobot.apps.forms.add_field_to_filter_form_class(form_class, field_name, field_obj)
¶
Attach a field to an existing filter form class.
Source code in nautobot/core/forms/utils.py
nautobot.apps.forms.expand_alphanumeric_pattern(string)
¶
Expand an alphabetic pattern into a list of strings.
Source code in nautobot/core/forms/utils.py
nautobot.apps.forms.expand_ipaddress_pattern(string, ip_version)
¶
Expand an IP address pattern into a list of strings. Examples: '192.0.2.[1,2,100-250]/24' => ['192.0.2.1/24', '192.0.2.2/24', '192.0.2.100/24' ... '192.0.2.250/24'] '2001:db8:0:[0,fd-ff]::/64' => ['2001:db8:0:0::/64', '2001:db8:0:fd::/64', ... '2001:db8:0:ff::/64']
Source code in nautobot/core/forms/utils.py
nautobot.apps.forms.form_from_model(model, fields)
¶
Return a Form class with the specified fields derived from a model. This is useful when we need a form to be used for creating objects, but want to avoid the model's validation (e.g. for bulk create/edit functions). All fields are marked as not required.
Source code in nautobot/core/forms/utils.py
nautobot.apps.forms.parse_alphanumeric_range(string)
¶
Expand an alphanumeric range (continuous or not) into a list. 'a-d,f' => [a, b, c, d, f] '0-3,a-d' => [0, 1, 2, 3, a, b, c, d]
Source code in nautobot/core/forms/utils.py
nautobot.apps.forms.parse_numeric_range(string, base=10)
¶
Expand a numeric range (continuous or not) into a decimal or hexadecimal list, as specified by the base parameter '0-3,5' => [0, 1, 2, 3, 5] '2,8-b,d,f' => [2, 8, 9, a, b, d, f]
Source code in nautobot/core/forms/utils.py
nautobot.apps.forms.restrict_form_fields(form, user, action='view')
¶
Restrict all form fields which reference a RestrictedQuerySet. This ensures that users see only permitted objects as available choices.