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

Allow import/export of regions (#1347)

This commit is contained in:
Faidon Liambotis
2017-07-18 01:50:26 +03:00
parent d73ea54e08
commit fbc5e74318
7 changed files with 49 additions and 1 deletions

View File

@@ -70,6 +70,28 @@ class RegionForm(BootstrapMixin, forms.ModelForm):
fields = ['parent', 'name', 'slug']
class RegionCSVForm(forms.ModelForm):
parent = forms.ModelChoiceField(
queryset=Region.objects.all(),
required=False,
to_field_name='name',
help_text='Name of parent region',
error_messages={
'invalid_choice': 'Region not found.',
}
)
class Meta:
model = Region
fields = [
'name', 'slug', 'parent',
]
help_texts = {
'name': 'Region name',
'slug': 'URL-friendly slug',
}
#
# Sites
#