mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
♻️ Use site name in query for racks when building devices (#29)
This commit is contained in:
parent
7a061a6b12
commit
6f9feaea10
@ -44,7 +44,14 @@ with file.open('r') as stream:
|
||||
for assoc, details in optional_assocs.items():
|
||||
if assoc in params:
|
||||
model, field = details
|
||||
query = { field: params.pop(assoc) }
|
||||
|
||||
if assoc == 'rack': # Special handling for rack query to reference rack name and site
|
||||
query = {
|
||||
'site': params.get('site'),
|
||||
field: params.pop(assoc),
|
||||
}
|
||||
else:
|
||||
query = { field: params.pop(assoc) }
|
||||
|
||||
params[assoc] = model.objects.get(**query)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user