mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-24 02:11:50 +01:00
* Replace site FK on Prefix with scope GFK * Add denormalized relations * Update prefix filters * Add generic relations for Prefix * Update GraphQL type for Prefix model * Fix tests; misc cleanup * Remove prefix_count from SiteSerializer * Remove site field from PrefixBulkEditForm * Restore scope filters for prefixes * Fix scope population on PrefixForm init * Show scope type * Assign scope during bulk import of prefixes * Correct handling of GenericForeignKey in PrefixForm * Add prefix counts to all scoped objects * Fix migration; linter fix * Add limit_choices_to on scope_type * Clean up cache_related_objects() * Enable bulk editing prefix scope
This commit is contained in:
@@ -167,12 +167,10 @@ class PrefixImportForm(NetBoxModelImportForm):
|
||||
to_field_name='name',
|
||||
help_text=_('Assigned tenant')
|
||||
)
|
||||
site = CSVModelChoiceField(
|
||||
label=_('Site'),
|
||||
queryset=Site.objects.all(),
|
||||
scope_type = CSVContentTypeField(
|
||||
queryset=ContentType.objects.filter(model__in=PREFIX_SCOPE_TYPES),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text=_('Assigned site')
|
||||
label=_('Scope type (app & model)')
|
||||
)
|
||||
vlan_group = CSVModelChoiceField(
|
||||
label=_('VLAN group'),
|
||||
@@ -204,9 +202,12 @@ class PrefixImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = Prefix
|
||||
fields = (
|
||||
'prefix', 'vrf', 'tenant', 'site', 'vlan_group', 'vlan', 'status', 'role', 'is_pool', 'mark_utilized',
|
||||
'description', 'comments', 'tags',
|
||||
'prefix', 'vrf', 'tenant', 'vlan_group', 'vlan', 'status', 'role', 'scope_type', 'scope_id', 'is_pool',
|
||||
'mark_utilized', 'description', 'comments', 'tags',
|
||||
)
|
||||
labels = {
|
||||
'scope_id': 'Scope ID',
|
||||
}
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(data, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user