class ProviderBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Provider.objects.all(), widget=forms.MultipleHiddenInput) asn = forms.IntegerField(required=False, label="ASN") account = forms.CharField(max_length=100, required=False, label="Account number") portal_url = forms.URLField(required=False, label="Portal") noc_contact = forms.CharField(required=False, widget=SmallTextarea, label="NOC contact") admin_contact = forms.CharField(required=False, widget=SmallTextarea, label="Admin contact") comments = CommentField(widget=SmallTextarea, label="Comments") class Meta: nullable_fields = [ "asn", "account", "portal_url", "noc_contact", "admin_contact", "comments", ]
class VirtualMachineBulkEditForm(BootstrapMixin, AddRemoveTagsForm, StatusBulkEditFormMixin, CustomFieldBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=VirtualMachine.objects.all(), widget=forms.MultipleHiddenInput()) cluster = DynamicModelChoiceField(queryset=Cluster.objects.all(), required=False) role = DynamicModelChoiceField( queryset=DeviceRole.objects.filter(vm_role=True), required=False, query_params={"vm_role": "True"}, ) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) platform = DynamicModelChoiceField(queryset=Platform.objects.all(), required=False) vcpus = forms.IntegerField(required=False, label="vCPUs") memory = forms.IntegerField(required=False, label="Memory (MB)") disk = forms.IntegerField(required=False, label="Disk (GB)") comments = CommentField(widget=SmallTextarea, label="Comments") class Meta: nullable_fields = [ "role", "tenant", "platform", "vcpus", "memory", "disk", "comments", ]
class ProviderForm(NautobotModelForm): slug = SlugField() comments = CommentField() class Meta: model = Provider fields = [ "name", "slug", "asn", "account", "portal_url", "noc_contact", "admin_contact", "comments", "tags", ] widgets = { "noc_contact": SmallTextarea(attrs={"rows": 5}), "admin_contact": SmallTextarea(attrs={"rows": 5}), } help_texts = { "name": "Full name of the provider", "asn": "BGP autonomous system number (if applicable)", "portal_url": "URL of the provider's customer support portal", "noc_contact": "NOC email address and phone number", "admin_contact": "Administrative contact email address and phone number", }
class CircuitForm(NautobotModelForm, TenancyForm): provider = DynamicModelChoiceField(queryset=Provider.objects.all()) type = DynamicModelChoiceField(queryset=CircuitType.objects.all()) comments = CommentField() class Meta: model = Circuit fields = [ "cid", "type", "provider", "status", "install_date", "commit_rate", "description", "tenant_group", "tenant", "comments", "tags", ] help_texts = { "cid": "Unique circuit ID", "commit_rate": "Committed rate", } widgets = { "install_date": DatePicker(), }
class CircuitForm(BootstrapMixin, TenancyForm, CustomFieldModelForm, RelationshipModelForm): provider = DynamicModelChoiceField(queryset=Provider.objects.all()) type = DynamicModelChoiceField(queryset=CircuitType.objects.all()) comments = CommentField() tags = DynamicModelMultipleChoiceField(queryset=Tag.objects.all(), required=False) class Meta: model = Circuit fields = [ "cid", "type", "provider", "status", "install_date", "commit_rate", "description", "tenant_group", "tenant", "comments", "tags", ] help_texts = { "cid": "Unique circuit ID", "commit_rate": "Committed rate", } widgets = { "install_date": DatePicker(), }
class ClusterBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Cluster.objects.all(), widget=forms.MultipleHiddenInput()) type = DynamicModelChoiceField(queryset=ClusterType.objects.all(), required=False) group = DynamicModelChoiceField(queryset=ClusterGroup.objects.all(), required=False) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False, to_field_name="slug") site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False, query_params={"region": "$region"}) comments = CommentField(widget=SmallTextarea, label="Comments") class Meta: nullable_fields = [ "group", "site", "comments", "tenant", ]
class ClusterForm(BootstrapMixin, TenancyForm, CustomFieldModelForm, RelationshipModelForm): type = DynamicModelChoiceField(queryset=ClusterType.objects.all()) group = DynamicModelChoiceField(queryset=ClusterGroup.objects.all(), required=False) region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False, initial_params={"sites": "$site"}) site = DynamicModelChoiceField( queryset=Site.objects.all(), required=False, query_params={"region_id": "$region"}, ) comments = CommentField() tags = DynamicModelMultipleChoiceField(queryset=Tag.objects.all(), required=False) class Meta: model = Cluster fields = ( "name", "type", "group", "tenant", "region", "site", "comments", "tags", )
class ClusterForm(NautobotModelForm, TenancyForm): type = DynamicModelChoiceField(queryset=ClusterType.objects.all()) group = DynamicModelChoiceField(queryset=ClusterGroup.objects.all(), required=False) region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False, initial_params={"sites": "$site"}) site = DynamicModelChoiceField( queryset=Site.objects.all(), required=False, query_params={"region_id": "$region"}, ) comments = CommentField() class Meta: model = Cluster fields = ( "name", "type", "group", "tenant", "region", "site", "comments", "tags", )
class ProviderNetworkBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=ProviderNetwork.objects.all(), widget=forms.MultipleHiddenInput) provider = DynamicModelChoiceField(queryset=Provider.objects.all(), required=False) description = forms.CharField(max_length=100, required=False) comments = CommentField(widget=SmallTextarea, label="Comments") class Meta: nullable_fields = [ "description", "comments", ]
class TenantForm(NautobotModelForm): slug = SlugField() group = DynamicModelChoiceField(queryset=TenantGroup.objects.all(), required=False) comments = CommentField() class Meta: model = Tenant fields = ( "name", "slug", "group", "description", "comments", "tags", )
class ProviderNetworkForm(NautobotModelForm): slug = SlugField() provider = DynamicModelChoiceField(queryset=Provider.objects.all()) comments = CommentField(label="Comments") class Meta: model = ProviderNetwork fields = [ "provider", "name", "slug", "description", "comments", "tags", ] fieldsets = (("Provider Network", ("provider", "name", "slug", "description", "comments", "tags")), )
class TenantForm(BootstrapMixin, CustomFieldModelForm, RelationshipModelForm): slug = SlugField() group = DynamicModelChoiceField(queryset=TenantGroup.objects.all(), required=False) comments = CommentField() tags = DynamicModelMultipleChoiceField(queryset=Tag.objects.all(), required=False) class Meta: model = Tenant fields = ( "name", "slug", "group", "description", "comments", "tags", )
class CircuitBulkEditForm(BootstrapMixin, AddRemoveTagsForm, StatusBulkEditFormMixin, CustomFieldBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Circuit.objects.all(), widget=forms.MultipleHiddenInput) type = DynamicModelChoiceField(queryset=CircuitType.objects.all(), required=False) provider = DynamicModelChoiceField(queryset=Provider.objects.all(), required=False) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) commit_rate = forms.IntegerField(required=False, label="Commit rate (Kbps)") description = forms.CharField(max_length=100, required=False) comments = CommentField(widget=SmallTextarea, label="Comments") class Meta: nullable_fields = [ "tenant", "commit_rate", "description", "comments", ]
class ProviderForm(BootstrapMixin, CustomFieldModelForm, RelationshipModelForm): slug = SlugField() comments = CommentField() tags = DynamicModelMultipleChoiceField(queryset=Tag.objects.all(), required=False) class Meta: model = Provider fields = [ "name", "slug", "asn", "account", "portal_url", "noc_contact", "admin_contact", "comments", "tags", ] widgets = { "noc_contact": SmallTextarea(attrs={"rows": 5}), "admin_contact": SmallTextarea(attrs={"rows": 5}), } help_texts = { "name": "Full name of the provider", "asn": "BGP autonomous system number (if applicable)", "portal_url": "URL of the provider's customer support portal", "noc_contact": "NOC email address and phone number", "admin_contact": "Administrative contact email address and phone number", }