You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`NetBoxModelFilterSetForm`| Filter objects within a list view |
13
13
14
14
### `NetBoxModelForm`
@@ -45,19 +45,20 @@ class MyModelForm(NetBoxModelForm):
45
45
!!! tip "Comment fields"
46
46
If your form has a `comments` field, there's no need to list it; this will always appear last on the page.
47
47
48
-
### `NetBoxModelCSVForm`
48
+
### `NetBoxModelImportForm`
49
49
50
-
This form facilitates the bulk import of new objects from CSV data. As with model forms, you'll need to declare a `Meta` subclass specifying the associated `model` and `fields`. NetBox also provides several form fields suitable for import various types of CSV data, listed below.
50
+
This form facilitates the bulk import of new objects from CSV, JSON, or YAML data. As with model forms, you'll need to declare a `Meta` subclass specifying the associated `model` and `fields`. NetBox also provides several form fields suitable for import various types of CSV data, listed below.
51
51
52
52
**Example**
53
53
54
54
```python
55
55
from dcim.models import Site
56
-
from netbox.forms importNetBoxModelCSVForm
56
+
from netbox.forms importNetBoxModelImportForm
57
57
from utilities.forms import CSVModelChoiceField
58
58
from .models import MyModel
59
59
60
-
classMyModelCSVForm(NetBoxModelCSVForm):
60
+
61
+
classMyModelImportForm(NetBoxModelImportForm):
61
62
site = CSVModelChoiceField(
62
63
queryset=Site.objects.all(),
63
64
to_field_name='name',
@@ -69,6 +70,9 @@ class MyModelCSVForm(NetBoxModelCSVForm):
69
70
fields = ('name', 'status', 'site', 'comments')
70
71
```
71
72
73
+
!!! note "Previously NetBoxModelCSVForm"
74
+
This form class was previously named `NetBoxModelCSVForm`. It was renamed in NetBox v3.4 to convey support for JSON and YAML formats in addition to CSV. The `NetBoxModelCSVForm` class has been retained for backward compatibility and functions exactly the same as `NetBoxModelImportForm`. However, plugin authors should be aware that this backward compatability will be removed in NetBox v3.5.
75
+
72
76
### `NetBoxModelBulkEditForm`
73
77
74
78
This form facilitates editing multiple objects in bulk. Unlike a model form, this form does not have a child `Meta` class, and must explicitly define each field. All fields in a bulk edit form are generally declared with `required=False`.
@@ -84,11 +88,12 @@ This form facilitates editing multiple objects in bulk. Unlike a model form, thi
84
88
```python
85
89
from django import forms
86
90
from dcim.models import Site
87
-
from netbox.forms importNetBoxModelCSVForm
91
+
from netbox.forms importNetBoxModelImportForm
88
92
from utilities.forms import CommentField, DynamicModelChoiceField
Copy file name to clipboardExpand all lines: docs/release-notes/version-3.4.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@
10
10
* The `noc_contact`, `admin_contact`, and `portal_url` fields have been removed from the provider model. Please replicate any data remaining in these fields to the contact model introduced in NetBox v3.1 prior to upgrading.
11
11
* The `content_type` field on the CustomLink and ExportTemplate models have been renamed to `content_types` and now supports the assignment of multiple content types.
12
12
* The `cf` property on an object with custom fields now returns deserialized values. For example, a custom field referencing an object will return the object instance rather than its numeric ID. To access the raw serialized values, use `custom_field_data` instead.
13
+
* The `NetBoxModelCSVForm` class has been renamed to `NetBoxModelImportForm`. Backward compatability with the previous name has been retained for this release, but will be dropped in NetBox v3.5.
0 commit comments