Closes: #9047 - Add Provider Accounts (#12057)

* #9047 - ProviderAccount

* #9047 - Move to new selector types

* #9047 - Re-introduce provider FK to Circuit model

* #9047 - Fix broken tests

* Misc cleanup

* Revert errant change

* Fix tests

* Update circuit filter form

---------

Co-authored-by: jeremystretch <jstretch@netboxlabs.com>
This commit is contained in:
Daniel Sheppard
2023-03-29 07:27:11 -05:00
committed by GitHub
parent d2a694a878
commit 9d709c84e7
35 changed files with 792 additions and 98 deletions

View File

@@ -13,6 +13,7 @@ __all__ = (
'CircuitTerminationImportForm',
'CircuitTypeImportForm',
'ProviderImportForm',
'ProviderAccountImportForm',
'ProviderNetworkImportForm',
)
@@ -23,7 +24,21 @@ class ProviderImportForm(NetBoxModelImportForm):
class Meta:
model = Provider
fields = (
'name', 'slug', 'account', 'description', 'comments', 'tags',
'name', 'slug', 'description', 'comments', 'tags',
)
class ProviderAccountImportForm(NetBoxModelImportForm):
provider = CSVModelChoiceField(
queryset=Provider.objects.all(),
to_field_name='name',
help_text=_('Assigned provider')
)
class Meta:
model = ProviderAccount
fields = (
'provider', 'name', 'account', 'description', 'comments', 'tags',
)
@@ -55,6 +70,11 @@ class CircuitImportForm(NetBoxModelImportForm):
to_field_name='name',
help_text=_('Assigned provider')
)
provider_account = CSVModelChoiceField(
queryset=ProviderAccount.objects.all(),
to_field_name='name',
help_text=_('Assigned provider account')
)
type = CSVModelChoiceField(
queryset=CircuitType.objects.all(),
to_field_name='name',
@@ -74,8 +94,8 @@ class CircuitImportForm(NetBoxModelImportForm):
class Meta:
model = Circuit
fields = [
'cid', 'provider', 'type', 'status', 'tenant', 'install_date', 'termination_date', 'commit_rate',
'description', 'comments', 'tags'
'cid', 'provider', 'provider_account', 'type', 'status', 'tenant', 'install_date', 'termination_date',
'commit_rate', 'description', 'comments', 'tags'
]