Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to the inheritance of forms to support bulk importing #2226

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions netbox/circuits/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Meta:
}


class ProviderCSVForm(forms.ModelForm):
class ProviderCSVForm(CustomFieldForm):
slug = SlugField()

class Meta:
Expand Down Expand Up @@ -116,7 +116,7 @@ class Meta:
}


class CircuitCSVForm(forms.ModelForm):
class CircuitCSVForm(CustomFieldForm):
provider = forms.ModelChoiceField(
queryset=Provider.objects.all(),
to_field_name='name',
Expand Down
8 changes: 4 additions & 4 deletions netbox/dcim/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Meta:
}


class SiteCSVForm(forms.ModelForm):
class SiteCSVForm(CustomFieldForm):
status = CSVChoiceField(
choices=SITE_STATUS_CHOICES,
required=False,
Expand Down Expand Up @@ -316,7 +316,7 @@ class Meta:
}


class RackCSVForm(forms.ModelForm):
class RackCSVForm(CustomFieldForm):
site = forms.ModelChoiceField(
queryset=Site.objects.all(),
to_field_name='name',
Expand Down Expand Up @@ -519,7 +519,7 @@ class Meta:
}


class DeviceTypeCSVForm(forms.ModelForm):
class DeviceTypeCSVForm(CustomFieldForm):
manufacturer = forms.ModelChoiceField(
queryset=Manufacturer.objects.all(),
required=True,
Expand Down Expand Up @@ -893,7 +893,7 @@ def __init__(self, *args, **kwargs):
self.initial['rack'] = self.instance.parent_bay.device.rack_id


class BaseDeviceCSVForm(forms.ModelForm):
class BaseDeviceCSVForm(CustomFieldForm):
device_role = forms.ModelChoiceField(
queryset=DeviceRole.objects.all(),
to_field_name='name',
Expand Down
10 changes: 5 additions & 5 deletions netbox/ipam/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Meta:
}


class VRFCSVForm(forms.ModelForm):
class VRFCSVForm(CustomFieldForm):
tenant = forms.ModelChoiceField(
queryset=Tenant.objects.all(),
required=False,
Expand Down Expand Up @@ -132,7 +132,7 @@ class Meta:
}


class AggregateCSVForm(forms.ModelForm):
class AggregateCSVForm(CustomFieldForm):
rir = forms.ModelChoiceField(
queryset=RIR.objects.all(),
to_field_name='name',
Expand Down Expand Up @@ -247,7 +247,7 @@ def __init__(self, *args, **kwargs):
self.fields['vrf'].empty_label = 'Global'


class PrefixCSVForm(forms.ModelForm):
class PrefixCSVForm(CustomFieldForm):
vrf = forms.ModelChoiceField(
queryset=VRF.objects.all(),
required=False,
Expand Down Expand Up @@ -543,7 +543,7 @@ def __init__(self, *args, **kwargs):
self.fields['vrf'].empty_label = 'Global'


class IPAddressCSVForm(forms.ModelForm):
class IPAddressCSVForm(CustomFieldForm):
vrf = forms.ModelChoiceField(
queryset=VRF.objects.all(),
required=False,
Expand Down Expand Up @@ -794,7 +794,7 @@ class Meta:
}


class VLANCSVForm(forms.ModelForm):
class VLANCSVForm(CustomFieldForm):
site = forms.ModelChoiceField(
queryset=Site.objects.all(),
required=False,
Expand Down
2 changes: 1 addition & 1 deletion netbox/tenancy/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Meta:
fields = ['name', 'slug', 'group', 'description', 'comments']


class TenantCSVForm(forms.ModelForm):
class TenantCSVForm(CustomFieldForm):
slug = SlugField()
group = forms.ModelChoiceField(
queryset=TenantGroup.objects.all(),
Expand Down
4 changes: 2 additions & 2 deletions netbox/virtualization/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Meta:
fields = ['name', 'type', 'group', 'site', 'comments']


class ClusterCSVForm(forms.ModelForm):
class ClusterCSVForm(CustomFieldForm):
type = forms.ModelChoiceField(
queryset=ClusterType.objects.all(),
to_field_name='name',
Expand Down Expand Up @@ -299,7 +299,7 @@ def __init__(self, *args, **kwargs):
self.fields['primary_ip6'].widget.attrs['readonly'] = True


class VirtualMachineCSVForm(forms.ModelForm):
class VirtualMachineCSVForm(CustomFieldForm):
status = CSVChoiceField(
choices=VM_STATUS_CHOICES,
required=False,
Expand Down