mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-23 03:58:45 -06:00
* Add SavedTableConfig * Update table configuration logic to support TableConfigs * Update table config link when updating table * Correct docstring * Misc cleanup * Use multi-select widgets for column selection * Return null config params for tables with no model * Fix auto-selection of selected columns * Update migration * Clean up template * Enforce enabled/shared flags * Search/filter by table name * Misc cleanup * Fix population of selected columns * Ordering field should not be required * Enable cloning for TableConfig * Misc cleanup * Add model documentation for TableConfig * Drop slug field from TableConfig * Improve TableConfig validation * Remove add button from TableConfig list view * Fix ordering validation to account for leading hyphens
This commit is contained in:
@@ -12,4 +12,5 @@ from .serializers_.configcontexts import *
|
||||
from .serializers_.configtemplates import *
|
||||
from .serializers_.savedfilters import *
|
||||
from .serializers_.scripts import *
|
||||
from .serializers_.tableconfigs import *
|
||||
from .serializers_.tags import *
|
||||
|
||||
22
netbox/extras/api/serializers_/tableconfigs.py
Normal file
22
netbox/extras/api/serializers_/tableconfigs.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from core.models import ObjectType
|
||||
from extras.models import TableConfig
|
||||
from netbox.api.fields import ContentTypeField
|
||||
from netbox.api.serializers import ValidatedModelSerializer
|
||||
|
||||
__all__ = (
|
||||
'TableConfigSerializer',
|
||||
)
|
||||
|
||||
|
||||
class TableConfigSerializer(ValidatedModelSerializer):
|
||||
object_type = ContentTypeField(
|
||||
queryset=ObjectType.objects.all()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = TableConfig
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'object_type', 'table', 'name', 'description', 'user', 'weight',
|
||||
'enabled', 'shared', 'columns', 'ordering', 'created', 'last_updated',
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description', 'object_type', 'table')
|
||||
@@ -14,6 +14,7 @@ router.register('custom-field-choice-sets', views.CustomFieldChoiceSetViewSet)
|
||||
router.register('custom-links', views.CustomLinkViewSet)
|
||||
router.register('export-templates', views.ExportTemplateViewSet)
|
||||
router.register('saved-filters', views.SavedFilterViewSet)
|
||||
router.register('table-configs', views.TableConfigViewSet)
|
||||
router.register('bookmarks', views.BookmarkViewSet)
|
||||
router.register('notifications', views.NotificationViewSet)
|
||||
router.register('notification-groups', views.NotificationGroupViewSet)
|
||||
|
||||
@@ -131,6 +131,17 @@ class SavedFilterViewSet(NetBoxModelViewSet):
|
||||
filterset_class = filtersets.SavedFilterFilterSet
|
||||
|
||||
|
||||
#
|
||||
# Table Configs
|
||||
#
|
||||
|
||||
class TableConfigViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = TableConfig.objects.all()
|
||||
serializer_class = serializers.TableConfigSerializer
|
||||
filterset_class = filtersets.TableConfigFilterSet
|
||||
|
||||
|
||||
#
|
||||
# Bookmarks
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user