mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
fixed location import #14064
This commit is contained in:
parent
276a73f820
commit
8571f428b1
@ -159,6 +159,14 @@ class LocationImportForm(NetBoxModelImportForm):
|
|||||||
model = Location
|
model = Location
|
||||||
fields = ('site', 'parent', 'name', 'slug', 'status', 'tenant', 'description', 'tags')
|
fields = ('site', 'parent', 'name', 'slug', 'status', 'tenant', 'description', 'tags')
|
||||||
|
|
||||||
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
|
super().__init__(data, *args, **kwargs)
|
||||||
|
|
||||||
|
if data:
|
||||||
|
# Limit location queryset by assigned site
|
||||||
|
params = {f"site__{self.fields['site'].to_field_name}": data.get('site')}
|
||||||
|
self.fields['parent'].queryset = self.fields['parent'].queryset.filter(**params)
|
||||||
|
|
||||||
|
|
||||||
class RackRoleImportForm(NetBoxModelImportForm):
|
class RackRoleImportForm(NetBoxModelImportForm):
|
||||||
slug = SlugField()
|
slug = SlugField()
|
||||||
|
Loading…
Reference in New Issue
Block a user