mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
custom fields, url in new window, bulk edit/import support
This commit is contained in:
parent
1eddade01e
commit
446ee761d3
@ -101,7 +101,7 @@ class CustomFieldSerializer(ValidatedModelSerializer):
|
|||||||
'id', 'url', 'display', 'content_types', 'type', 'object_type', 'data_type', 'name', 'label', 'group_name',
|
'id', 'url', 'display', 'content_types', 'type', 'object_type', 'data_type', 'name', 'label', 'group_name',
|
||||||
'description', 'required', 'search_weight', 'filter_logic', 'ui_visibility', 'is_cloneable', 'default',
|
'description', 'required', 'search_weight', 'filter_logic', 'ui_visibility', 'is_cloneable', 'default',
|
||||||
'weight', 'validation_minimum', 'validation_maximum', 'validation_regex', 'choices', 'created',
|
'weight', 'validation_minimum', 'validation_maximum', 'validation_regex', 'choices', 'created',
|
||||||
'last_updated',
|
'last_updated', 'new_window',
|
||||||
]
|
]
|
||||||
|
|
||||||
def validate_type(self, value):
|
def validate_type(self, value):
|
||||||
|
@ -48,6 +48,10 @@ class CustomFieldBulkEditForm(BulkEditForm):
|
|||||||
required=False,
|
required=False,
|
||||||
widget=BulkEditNullBooleanSelect()
|
widget=BulkEditNullBooleanSelect()
|
||||||
)
|
)
|
||||||
|
new_window = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect()
|
||||||
|
)
|
||||||
|
|
||||||
nullable_fields = ('group_name', 'description',)
|
nullable_fields = ('group_name', 'description',)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class CustomFieldImportForm(CSVModelForm):
|
|||||||
fields = (
|
fields = (
|
||||||
'name', 'label', 'group_name', 'type', 'content_types', 'object_type', 'required', 'description',
|
'name', 'label', 'group_name', 'type', 'content_types', 'object_type', 'required', 'description',
|
||||||
'search_weight', 'filter_logic', 'default', 'choices', 'weight', 'validation_minimum', 'validation_maximum',
|
'search_weight', 'filter_logic', 'default', 'choices', 'weight', 'validation_minimum', 'validation_maximum',
|
||||||
'validation_regex', 'ui_visibility', 'is_cloneable',
|
'validation_regex', 'ui_visibility', 'is_cloneable', 'new_window',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
base_field=models.CharField(max_length=100),
|
base_field=models.CharField(max_length=100),
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('Comma-separated list of available choices (for selection fields)')
|
help_text=_('Comma-separated list of available choices (for url fields)')
|
||||||
)
|
)
|
||||||
ui_visibility = models.CharField(
|
ui_visibility = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
@ -178,7 +178,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
)
|
)
|
||||||
new_window = models.BooleanField(
|
new_window = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text=_("Force link to open in a new window")
|
help_text=_("Force link to open in a new window (for selection fields)")
|
||||||
)
|
)
|
||||||
|
|
||||||
objects = CustomFieldManager()
|
objects = CustomFieldManager()
|
||||||
|
@ -64,6 +64,10 @@
|
|||||||
<th scope="row">Cloneable</th>
|
<th scope="row">Cloneable</th>
|
||||||
<td>{% checkmark object.is_cloneable %}</td>
|
<td>{% checkmark object.is_cloneable %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">New Window</th>
|
||||||
|
<td>{% checkmark object.new_window %}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user