1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #704: Allow filtering VLANs by group when editing prefixes

This commit is contained in:
Jeremy Stretch
2017-06-09 14:15:12 -04:00
parent 9e1d03b383
commit 05a796faf1
3 changed files with 32 additions and 5 deletions

View File

@ -478,8 +478,8 @@ class ChainedFieldsMixin(forms.BaseForm):
filters_dict = {}
for (db_field, parent_field) in field.chains:
if self.is_bound and self.data.get(parent_field):
filters_dict[db_field] = self.data[parent_field]
if self.is_bound and parent_field in self.data:
filters_dict[db_field] = self.data[parent_field] or None
elif self.initial.get(parent_field):
filters_dict[db_field] = self.initial[parent_field]
elif self.fields[parent_field].widget.attrs.get('nullable'):