mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-14 15:52:18 -06:00
* Move Module & ModuleType models to a separate file * Add ModuleTypeProfile & related fields * Initial work on JSON schema validation * Add attributes property on ModuleType * Introduce MultipleOfValidator * Introduce JSONSchemaProperty * Enable dynamic form field rendering * Misc cleanup * Fix migration conflict * Ensure deterministic ordering of attriubte fields * Support choices & default values * Include module type attributes on module view * Enable modifying individual attributes via REST API * Enable filtering by attribute values * Add documentation & tests * Schema should be optional * Include attributes column for profiles * Profile is nullable * Include some initial profiles to be installed via migration * Fix migrations conflict * Fix filterset test * Misc cleanup * Fixes #19023: get_field_value() should respect null values in bound forms (#19024) * Skip filters which do not specify a JSON-serializable value * Fix handling of array item types * Fix initial data in schema field during bulk edit * Implement sanity checking for JSON schema definitions * Fall back to filtering by string value
This commit is contained in:
@@ -1247,6 +1247,62 @@ class DeviceTypeBulkDeleteView(generic.BulkDeleteView):
|
||||
table = tables.DeviceTypeTable
|
||||
|
||||
|
||||
#
|
||||
# Module type profiles
|
||||
#
|
||||
|
||||
@register_model_view(ModuleTypeProfile, 'list', path='', detail=False)
|
||||
class ModuleTypeProfileListView(generic.ObjectListView):
|
||||
queryset = ModuleTypeProfile.objects.annotate(
|
||||
instance_count=count_related(ModuleType, 'profile')
|
||||
)
|
||||
filterset = filtersets.ModuleTypeProfileFilterSet
|
||||
filterset_form = forms.ModuleTypeProfileFilterForm
|
||||
table = tables.ModuleTypeProfileTable
|
||||
|
||||
|
||||
@register_model_view(ModuleTypeProfile)
|
||||
class ModuleTypeProfileView(GetRelatedModelsMixin, generic.ObjectView):
|
||||
queryset = ModuleTypeProfile.objects.all()
|
||||
|
||||
|
||||
@register_model_view(ModuleTypeProfile, 'add', detail=False)
|
||||
@register_model_view(ModuleTypeProfile, 'edit')
|
||||
class ModuleTypeProfileEditView(generic.ObjectEditView):
|
||||
queryset = ModuleTypeProfile.objects.all()
|
||||
form = forms.ModuleTypeProfileForm
|
||||
|
||||
|
||||
@register_model_view(ModuleTypeProfile, 'delete')
|
||||
class ModuleTypeProfileDeleteView(generic.ObjectDeleteView):
|
||||
queryset = ModuleTypeProfile.objects.all()
|
||||
|
||||
|
||||
@register_model_view(ModuleTypeProfile, 'bulk_import', detail=False)
|
||||
class ModuleTypeProfileBulkImportView(generic.BulkImportView):
|
||||
queryset = ModuleTypeProfile.objects.all()
|
||||
model_form = forms.ModuleTypeProfileImportForm
|
||||
|
||||
|
||||
@register_model_view(ModuleTypeProfile, 'bulk_edit', path='edit', detail=False)
|
||||
class ModuleTypeProfileBulkEditView(generic.BulkEditView):
|
||||
queryset = ModuleTypeProfile.objects.annotate(
|
||||
instance_count=count_related(Module, 'module_type')
|
||||
)
|
||||
filterset = filtersets.ModuleTypeProfileFilterSet
|
||||
table = tables.ModuleTypeProfileTable
|
||||
form = forms.ModuleTypeProfileBulkEditForm
|
||||
|
||||
|
||||
@register_model_view(ModuleTypeProfile, 'bulk_delete', path='delete', detail=False)
|
||||
class ModuleTypeProfileBulkDeleteView(generic.BulkDeleteView):
|
||||
queryset = ModuleTypeProfile.objects.annotate(
|
||||
instance_count=count_related(Module, 'module_type')
|
||||
)
|
||||
filterset = filtersets.ModuleTypeProfileFilterSet
|
||||
table = tables.ModuleTypeProfileTable
|
||||
|
||||
|
||||
#
|
||||
# Module types
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user