Fixes #4756: Filter parent group by site when creating rack groups

This commit is contained in:
Jeremy Stretch 2020-06-15 10:02:35 -04:00
parent 9fc4a4f24a
commit 2e5058c4c9
2 changed files with 9 additions and 1 deletions

View File

@ -16,6 +16,7 @@
* [#4736](https://github.com/netbox-community/netbox/issues/4736) - Add cable trace endpoints for pass-through ports * [#4736](https://github.com/netbox-community/netbox/issues/4736) - Add cable trace endpoints for pass-through ports
* [#4737](https://github.com/netbox-community/netbox/issues/4737) - Fix display of role labels in virtual machines table * [#4737](https://github.com/netbox-community/netbox/issues/4737) - Fix display of role labels in virtual machines table
* [#4743](https://github.com/netbox-community/netbox/issues/4743) - Allow users to create "next available" IPs without needing permission to create prefixes * [#4743](https://github.com/netbox-community/netbox/issues/4743) - Allow users to create "next available" IPs without needing permission to create prefixes
* [#4756](https://github.com/netbox-community/netbox/issues/4756) - Filter parent group by site when creating rack groups
--- ---

View File

@ -363,7 +363,14 @@ class SiteFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldFilterForm):
class RackGroupForm(BootstrapMixin, forms.ModelForm): class RackGroupForm(BootstrapMixin, forms.ModelForm):
site = DynamicModelChoiceField( site = DynamicModelChoiceField(
queryset=Site.objects.all() queryset=Site.objects.all(),
to_field_name='slug',
widget=APISelect(
value_field='slug',
filter_for={
'parent': 'site',
}
)
) )
parent = DynamicModelChoiceField( parent = DynamicModelChoiceField(
queryset=RackGroup.objects.all(), queryset=RackGroup.objects.all(),