nautobot 2.4.13__py3-none-any.whl → 2.4.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nautobot might be problematic. Click here for more details.
- nautobot/apps/choices.py +8 -0
- nautobot/apps/ui.py +14 -0
- nautobot/core/api/views.py +2 -0
- nautobot/core/choices.py +4 -0
- nautobot/core/filters.py +21 -41
- nautobot/core/graphql/generators.py +8 -0
- nautobot/core/graphql/schema.py +30 -30
- nautobot/core/management/commands/check_job_approval_status.py +47 -0
- nautobot/core/management/commands/generate_test_data.py +1 -1
- nautobot/core/management/commands/migrate.py +90 -1
- nautobot/core/models/tree_queries.py +17 -0
- nautobot/core/settings.py +2 -2
- nautobot/core/settings.yaml +3 -3
- nautobot/core/tables.py +29 -6
- nautobot/core/templates/base_django.html +1 -1
- nautobot/core/templates/components/panel/header_extra_content_table.html +1 -1
- nautobot/core/templates/generic/object_list.html +17 -20
- nautobot/core/templates/inc/breadcrumbs.html +14 -0
- nautobot/core/templatetags/buttons.py +2 -4
- nautobot/core/templatetags/helpers.py +29 -6
- nautobot/core/templatetags/ui_framework.py +21 -0
- nautobot/core/testing/api.py +7 -0
- nautobot/core/testing/filters.py +20 -3
- nautobot/core/testing/forms.py +1 -1
- nautobot/core/tests/integration/test_filters.py +2 -2
- nautobot/core/tests/test_breadcrumbs.py +366 -0
- nautobot/core/tests/test_commands.py +40 -0
- nautobot/core/tests/test_filters.py +51 -1
- nautobot/core/tests/test_forms.py +1 -1
- nautobot/core/tests/test_graphql.py +4 -4
- nautobot/core/tests/test_titles.py +183 -0
- nautobot/core/tests/test_tree_queries.py +30 -0
- nautobot/core/tests/test_views.py +2 -2
- nautobot/core/tests/test_views_utils.py +1 -1
- nautobot/core/ui/breadcrumbs.py +538 -0
- nautobot/core/ui/bulk_buttons.py +53 -0
- nautobot/core/ui/object_detail.py +31 -8
- nautobot/core/ui/titles.py +127 -0
- nautobot/core/ui/utils.py +25 -0
- nautobot/core/utils/migrations.py +1 -1
- nautobot/core/views/__init__.py +1 -1
- nautobot/core/views/mixins.py +26 -1
- nautobot/core/views/renderers.py +20 -2
- nautobot/core/views/utils.py +14 -13
- nautobot/dcim/api/serializers.py +9 -0
- nautobot/dcim/choices.py +55 -0
- nautobot/dcim/constants.py +0 -16
- nautobot/dcim/factory.py +1 -1
- nautobot/dcim/filters/__init__.py +15 -3
- nautobot/dcim/forms.py +120 -7
- nautobot/dcim/management/commands/trace_paths.py +1 -1
- nautobot/dcim/migrations/0072_alter_powerfeed_options_and_more.py +97 -0
- nautobot/dcim/models/device_component_templates.py +8 -0
- nautobot/dcim/models/device_components.py +31 -12
- nautobot/dcim/models/devices.py +1 -1
- nautobot/dcim/models/power.py +171 -10
- nautobot/dcim/models/racks.py +7 -4
- nautobot/dcim/tables/devices.py +2 -0
- nautobot/dcim/tables/devicetypes.py +1 -0
- nautobot/dcim/tables/power.py +30 -2
- nautobot/dcim/templates/dcim/device.html +2 -2
- nautobot/dcim/templates/dcim/devicetype_retrieve.html +1 -214
- nautobot/dcim/templates/dcim/location_retrieve.html +2 -2
- nautobot/dcim/templates/dcim/powerfeed_edit.html +8 -0
- nautobot/dcim/templates/dcim/powerfeed_retrieve.html +1 -1
- nautobot/dcim/templates/dcim/rack.html +2 -318
- nautobot/dcim/templates/dcim/rack_edit.html +2 -47
- nautobot/dcim/templates/dcim/rack_retrieve.html +318 -0
- nautobot/dcim/templates/dcim/rack_update.html +47 -0
- nautobot/dcim/tests/integration/test_device_bulk_operations.py +61 -0
- nautobot/dcim/tests/test_api.py +24 -4
- nautobot/dcim/tests/test_filters.py +91 -13
- nautobot/dcim/tests/test_models.py +262 -0
- nautobot/dcim/tests/test_views.py +20 -12
- nautobot/dcim/urls.py +2 -27
- nautobot/dcim/utils.py +13 -30
- nautobot/dcim/views.py +428 -146
- nautobot/extras/choices.py +12 -4
- nautobot/extras/factory.py +19 -20
- nautobot/extras/filters/__init__.py +3 -2
- nautobot/extras/filters/mixins.py +23 -7
- nautobot/extras/forms/__init__.py +2 -1
- nautobot/extras/forms/forms.py +71 -0
- nautobot/extras/forms/mixins.py +4 -2
- nautobot/extras/managers.py +4 -1
- nautobot/extras/migrations/0062_collect_roles_from_related_apps_roles.py +30 -7
- nautobot/extras/migrations/0124_add_joblogentry_index.py +16 -0
- nautobot/extras/migrations/0125_jobresult_date_started.py +18 -0
- nautobot/extras/models/customfields.py +53 -5
- nautobot/extras/models/datasources.py +1 -2
- nautobot/extras/models/jobs.py +13 -3
- nautobot/extras/models/relationships.py +55 -6
- nautobot/extras/plugins/views.py +24 -1
- nautobot/extras/secrets/__init__.py +1 -1
- nautobot/extras/tables.py +9 -0
- nautobot/extras/templates/extras/customfield.html +2 -129
- nautobot/extras/templates/extras/customfield_edit.html +2 -108
- nautobot/extras/templates/extras/customfield_retrieve.html +129 -0
- nautobot/extras/templates/extras/customfield_update.html +108 -0
- nautobot/extras/templates/extras/graphqlquery.html +2 -97
- nautobot/extras/templates/extras/graphqlquery_list.html +1 -0
- nautobot/extras/templates/extras/graphqlquery_retrieve.html +97 -0
- nautobot/extras/templates/extras/inc/jobresult.html +7 -3
- nautobot/extras/templates/extras/jobresult.html +2 -155
- nautobot/extras/templates/extras/jobresult_retrieve.html +155 -0
- nautobot/extras/templates/extras/marketplace.html +5 -6
- nautobot/extras/templates/extras/note.html +2 -53
- nautobot/extras/templates/extras/note_retrieve.html +53 -0
- nautobot/extras/templates/extras/plugins_list.html +5 -6
- nautobot/extras/templates/extras/secretsgroup.html +2 -29
- nautobot/extras/templates/extras/secretsgroup_edit.html +2 -82
- nautobot/extras/templates/extras/secretsgroup_retrieve.html +29 -0
- nautobot/extras/templates/extras/secretsgroup_update.html +82 -0
- nautobot/extras/templatetags/custom_links.py +2 -2
- nautobot/extras/templatetags/job_buttons.py +1 -1
- nautobot/extras/templatetags/plugins.py +1 -1
- nautobot/extras/tests/integration/test_computedfields.py +2 -2
- nautobot/extras/tests/integration/test_customfields.py +14 -11
- nautobot/extras/tests/integration/test_dynamicgroups.py +1 -1
- nautobot/extras/tests/integration/test_notes.py +1 -1
- nautobot/extras/tests/integration/test_plugins.py +6 -6
- nautobot/extras/tests/integration/test_relationships.py +2 -2
- nautobot/extras/tests/test_customfields.py +115 -7
- nautobot/extras/tests/test_filters.py +9 -0
- nautobot/extras/tests/test_forms.py +2 -2
- nautobot/extras/tests/test_plugins.py +2 -3
- nautobot/extras/tests/test_relationships.py +14 -8
- nautobot/extras/tests/test_views.py +285 -2
- nautobot/extras/urls.py +5 -110
- nautobot/extras/utils.py +5 -2
- nautobot/extras/views.py +116 -311
- nautobot/ipam/api/views.py +69 -6
- nautobot/ipam/tables.py +8 -15
- nautobot/ipam/tests/migration/test_migrations.py +8 -8
- nautobot/ipam/tests/test_api.py +352 -2
- nautobot/ipam/tests/test_models.py +1 -1
- nautobot/project-static/docs/404.html +34 -34
- nautobot/project-static/docs/apps/index.html +34 -34
- nautobot/project-static/docs/apps/nautobot-apps.html +34 -34
- nautobot/project-static/docs/assets/_mkdocstrings.css +44 -6
- nautobot/project-static/docs/assets/javascripts/{bundle.56ea9cef.min.js → bundle.50899def.min.js} +2 -2
- nautobot/project-static/docs/assets/javascripts/{bundle.56ea9cef.min.js.map → bundle.50899def.min.js.map} +2 -2
- nautobot/project-static/docs/assets/stylesheets/{main.342714a4.min.css → main.7e37652d.min.css} +1 -1
- nautobot/project-static/docs/assets/stylesheets/{main.342714a4.min.css.map → main.7e37652d.min.css.map} +1 -1
- nautobot/project-static/docs/code-reference/nautobot/apps/__init__.html +39 -34
- nautobot/project-static/docs/code-reference/nautobot/apps/admin.html +36 -34
- nautobot/project-static/docs/code-reference/nautobot/apps/api.html +139 -54
- nautobot/project-static/docs/code-reference/nautobot/apps/change_logging.html +48 -38
- nautobot/project-static/docs/code-reference/nautobot/apps/choices.html +50 -40
- nautobot/project-static/docs/code-reference/nautobot/apps/config.html +36 -34
- nautobot/project-static/docs/code-reference/nautobot/apps/constants.html +35 -34
- nautobot/project-static/docs/code-reference/nautobot/apps/datasources.html +43 -39
- nautobot/project-static/docs/code-reference/nautobot/apps/events.html +52 -42
- nautobot/project-static/docs/code-reference/nautobot/apps/exceptions.html +50 -41
- nautobot/project-static/docs/code-reference/nautobot/apps/factory.html +54 -44
- nautobot/project-static/docs/code-reference/nautobot/apps/filters.html +85 -93
- nautobot/project-static/docs/code-reference/nautobot/apps/forms.html +154 -62
- nautobot/project-static/docs/code-reference/nautobot/apps/graphql.html +54 -46
- nautobot/project-static/docs/code-reference/nautobot/apps/jobs.html +146 -87
- nautobot/project-static/docs/code-reference/nautobot/apps/models.html +240 -70
- nautobot/project-static/docs/code-reference/nautobot/apps/querysets.html +38 -35
- nautobot/project-static/docs/code-reference/nautobot/apps/secrets.html +41 -35
- nautobot/project-static/docs/code-reference/nautobot/apps/tables.html +173 -52
- nautobot/project-static/docs/code-reference/nautobot/apps/testing.html +269 -85
- nautobot/project-static/docs/code-reference/nautobot/apps/ui.html +5987 -2643
- nautobot/project-static/docs/code-reference/nautobot/apps/urls.html +36 -34
- nautobot/project-static/docs/code-reference/nautobot/apps/utils.html +165 -89
- nautobot/project-static/docs/code-reference/nautobot/apps/views.html +161 -69
- nautobot/project-static/docs/development/apps/api/configuration-view.html +34 -34
- nautobot/project-static/docs/development/apps/api/database-backend-config.html +34 -34
- nautobot/project-static/docs/development/apps/api/models/django-admin.html +34 -34
- nautobot/project-static/docs/development/apps/api/models/global-search.html +34 -34
- nautobot/project-static/docs/development/apps/api/models/graphql.html +34 -34
- nautobot/project-static/docs/development/apps/api/models/index.html +34 -34
- nautobot/project-static/docs/development/apps/api/nautobot-app-config.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/custom-validators.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/filter-extensions.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/git-repository-content.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/index.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/jinja2-filters.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/jobs.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/populating-extensibility-features.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/secrets-providers.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/table-extensions.html +34 -34
- nautobot/project-static/docs/development/apps/api/platform-features/uniquely-identify-objects.html +34 -34
- nautobot/project-static/docs/development/apps/api/prometheus.html +34 -34
- nautobot/project-static/docs/development/apps/api/setup.html +34 -34
- nautobot/project-static/docs/development/apps/api/testing.html +34 -34
- nautobot/project-static/docs/development/apps/api/ui-extensions/banners.html +34 -34
- nautobot/project-static/docs/development/apps/api/ui-extensions/home-page.html +34 -34
- nautobot/project-static/docs/development/apps/api/ui-extensions/index.html +34 -34
- nautobot/project-static/docs/development/apps/api/ui-extensions/navigation.html +34 -34
- nautobot/project-static/docs/development/apps/api/ui-extensions/object-views.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/base-template.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/core-view-overrides.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/django-generic-views.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/help-documentation.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/index.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/nautobot-generic-views.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/nautobotuiviewset.html +42 -36
- nautobot/project-static/docs/development/apps/api/views/nautobotuiviewsetrouter.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/notes.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/rest-api.html +34 -34
- nautobot/project-static/docs/development/apps/api/views/urls.html +34 -34
- nautobot/project-static/docs/development/apps/index.html +34 -34
- nautobot/project-static/docs/development/apps/migration/code-updates.html +34 -34
- nautobot/project-static/docs/development/apps/migration/dependency-updates.html +34 -34
- nautobot/project-static/docs/development/apps/migration/from-v1.html +34 -34
- nautobot/project-static/docs/development/apps/migration/model-updates/dcim.html +34 -34
- nautobot/project-static/docs/development/apps/migration/model-updates/extras.html +34 -34
- nautobot/project-static/docs/development/apps/migration/model-updates/global.html +34 -34
- nautobot/project-static/docs/development/apps/migration/model-updates/ipam.html +34 -34
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/best-practices.html +37 -37
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/breadcrumbs-titles.html +10544 -0
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/custom-content.html +34 -34
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/index.html +34 -34
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/migration-steps.html +34 -34
- nautobot/project-static/docs/development/apps/porting-from-netbox.html +37 -37
- nautobot/project-static/docs/development/core/application-registry.html +162 -133
- nautobot/project-static/docs/development/core/best-practices.html +34 -34
- nautobot/project-static/docs/development/core/bootstrap-ui.html +34 -34
- nautobot/project-static/docs/development/core/caching.html +34 -34
- nautobot/project-static/docs/development/core/controllers.html +34 -34
- nautobot/project-static/docs/development/core/docker-compose-advanced-use-cases.html +34 -34
- nautobot/project-static/docs/development/core/generic-views.html +34 -34
- nautobot/project-static/docs/development/core/getting-started.html +34 -34
- nautobot/project-static/docs/development/core/homepage.html +34 -34
- nautobot/project-static/docs/development/core/index.html +34 -34
- nautobot/project-static/docs/development/core/minikube-dev-environment-for-k8s-jobs.html +34 -34
- nautobot/project-static/docs/development/core/model-checklist.html +34 -34
- nautobot/project-static/docs/development/core/model-features.html +34 -34
- nautobot/project-static/docs/development/core/natural-keys.html +34 -34
- nautobot/project-static/docs/development/core/navigation-menu.html +34 -34
- nautobot/project-static/docs/development/core/release-checklist.html +34 -34
- nautobot/project-static/docs/development/core/role-internals.html +34 -34
- nautobot/project-static/docs/development/core/settings.html +34 -34
- nautobot/project-static/docs/development/core/style-guide.html +34 -34
- nautobot/project-static/docs/development/core/templates.html +34 -34
- nautobot/project-static/docs/development/core/testing.html +34 -34
- nautobot/project-static/docs/development/core/ui-component-framework.html +724 -289
- nautobot/project-static/docs/development/core/user-preferences.html +34 -34
- nautobot/project-static/docs/development/index.html +34 -34
- nautobot/project-static/docs/development/jobs/getting-started.html +34 -34
- nautobot/project-static/docs/development/jobs/index.html +34 -34
- nautobot/project-static/docs/development/jobs/installation.html +34 -34
- nautobot/project-static/docs/development/jobs/job-extensions.html +34 -34
- nautobot/project-static/docs/development/jobs/job-logging.html +34 -34
- nautobot/project-static/docs/development/jobs/job-patterns.html +34 -34
- nautobot/project-static/docs/development/jobs/job-structure.html +34 -34
- nautobot/project-static/docs/development/jobs/migration/from-v1.html +34 -34
- nautobot/project-static/docs/development/jobs/testing.html +34 -34
- nautobot/project-static/docs/index.html +34 -34
- nautobot/project-static/docs/media/development/core/ui-component-framework/breadcrumbs-titles-data-flow.png +0 -0
- nautobot/project-static/docs/media/power_distribution.png +0 -0
- nautobot/project-static/docs/objects.inv +0 -0
- nautobot/project-static/docs/overview/application_stack.html +34 -34
- nautobot/project-static/docs/overview/design_philosophy.html +34 -34
- nautobot/project-static/docs/release-notes/index.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.0.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.1.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.2.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.3.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.4.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.5.html +34 -34
- nautobot/project-static/docs/release-notes/version-1.6.html +34 -34
- nautobot/project-static/docs/release-notes/version-2.0.html +34 -34
- nautobot/project-static/docs/release-notes/version-2.1.html +34 -34
- nautobot/project-static/docs/release-notes/version-2.2.html +34 -34
- nautobot/project-static/docs/release-notes/version-2.3.html +34 -34
- nautobot/project-static/docs/release-notes/version-2.4.html +402 -34
- nautobot/project-static/docs/requirements.txt +3 -3
- nautobot/project-static/docs/search/search_index.json +1 -1
- nautobot/project-static/docs/sitemap.xml +303 -299
- nautobot/project-static/docs/sitemap.xml.gz +0 -0
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/ldap.html +34 -34
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/remote.html +34 -34
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/sso.html +34 -34
- nautobot/project-static/docs/user-guide/administration/configuration/index.html +34 -34
- nautobot/project-static/docs/user-guide/administration/configuration/redis.html +34 -34
- nautobot/project-static/docs/user-guide/administration/configuration/settings.html +37 -37
- nautobot/project-static/docs/user-guide/administration/configuration/time-zones.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/celery-queues.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/docker.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/health-checks.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/permissions.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/prometheus-metrics.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/replicating-nautobot.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/request-profiling.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/s3-django-storage.html +34 -34
- nautobot/project-static/docs/user-guide/administration/guides/selinux-troubleshooting.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/app-install.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/external-authentication.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/http-server.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/index.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/install_system.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/nautobot.html +34 -34
- nautobot/project-static/docs/user-guide/administration/installation/services.html +34 -34
- nautobot/project-static/docs/user-guide/administration/migration/migrating-from-netbox.html +34 -34
- nautobot/project-static/docs/user-guide/administration/migration/migrating-from-postgresql.html +34 -34
- nautobot/project-static/docs/user-guide/administration/security/index.html +34 -34
- nautobot/project-static/docs/user-guide/administration/security/notices.html +34 -34
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-server.html +296 -251
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-shell.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/database-backup.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/after-you-upgrade.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/before-you-upgrade.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/for-developers.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/index.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/whats-changed.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/region-and-site-data-migration-guide.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/upgrading-from-nautobot-v1.html +34 -34
- nautobot/project-static/docs/user-guide/administration/upgrading/upgrading.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/circuits/circuit.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/circuits/circuittermination.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/circuits/circuittype.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/circuits/provider.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/circuits/providernetwork.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloud.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudaccount.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudnetwork.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudnetworkprefixassignment.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudresourcetype.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudservice.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudservicenetworkassignment.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/cable.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleport.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleporttemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleserverport.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleserverporttemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/controller.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/controllermanageddevicegroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/device.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicebay.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicebaytemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicefamily.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/deviceredundancygroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicetype.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/frontport.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/frontporttemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interface.html +37 -37
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interfaceredundancygroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interfacetemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/inventoryitem.html +42 -52
- nautobot/project-static/docs/user-guide/core-data-model/dcim/location.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/locationtype.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/manufacturer.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/module.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/modulebay.html +37 -37
- nautobot/project-static/docs/user-guide/core-data-model/dcim/modulebaytemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/modulefamily.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/moduletype.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/platform.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerfeed.html +316 -39
- nautobot/project-static/docs/user-guide/core-data-model/dcim/poweroutlet.html +35 -35
- nautobot/project-static/docs/user-guide/core-data-model/dcim/poweroutlettemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerpanel.html +147 -37
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerport.html +52 -35
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerporttemplate.html +51 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rack.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rackgroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rackreservation.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rearport.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rearporttemplate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/softwareimagefile.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/softwareversion.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/virtualchassis.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/dcim/virtualdevicecontext.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/extras/configcontext.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/extras/configcontextschema.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/extras/contact.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/extras/team.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/ipaddress.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/namespace.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/prefix.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/rir.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/routetarget.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/service.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vlan.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vlangroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vrf.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/overview/introduction.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/tenancy/tenant.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/tenancy/tenantgroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/cluster.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/clustergroup.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/clustertype.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/virtualmachine.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/vminterface.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/wireless/index.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/wireless/radioprofile.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/wireless/supporteddatarate.html +34 -34
- nautobot/project-static/docs/user-guide/core-data-model/wireless/wirelessnetwork.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/contacts-and-teams.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/custom-fields.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/creating-devices.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/creating-location-types-and-locations.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/index.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/interfaces.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/ipam.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/platforms.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/search-bar.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/tenants.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/vlans-and-vlan-groups.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/git-data-source.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/graphql.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/ip-address-merge-tool.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/relationships.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/software-image-files-and-versions.html +34 -34
- nautobot/project-static/docs/user-guide/feature-guides/wireless-networks-and-controllers.html +34 -34
- nautobot/project-static/docs/user-guide/index.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/change-logging.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/computedfield.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/customfield.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/customlink.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/dynamicgroup.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/events.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/exporttemplate.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/externalintegration.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/gitrepository.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/graphql.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/graphqlquery.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/imageattachment.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/index.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/job-scheduling-and-approvals.html +35 -35
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobbutton.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobhook.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobqueue.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/kubernetes-job-support.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/managing-jobs.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/models.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/napalm.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/note.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/objectmetadata.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/relationship.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/rendering-jinja-templates.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/authentication.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/filtering.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/overview.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/ui-related-endpoints.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/role.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/savedview.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/secret.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/staticgroupassociation.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/status.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/tag.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/template-filters.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/users/objectpermission.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/users/token.html +34 -34
- nautobot/project-static/docs/user-guide/platform-functionality/webhook.html +34 -34
- nautobot/tenancy/api/views.py +2 -1
- nautobot/users/tests/test_api.py +2 -2
- nautobot/virtualization/templates/virtualization/virtualmachine.html +2 -252
- nautobot/virtualization/templates/virtualization/virtualmachine_edit.html +2 -75
- nautobot/virtualization/templates/virtualization/virtualmachine_retrieve.html +252 -0
- nautobot/virtualization/templates/virtualization/virtualmachine_update.html +75 -0
- nautobot/virtualization/urls.py +3 -61
- nautobot/virtualization/views.py +48 -72
- {nautobot-2.4.13.dist-info → nautobot-2.4.15.dist-info}/METADATA +27 -27
- {nautobot-2.4.13.dist-info → nautobot-2.4.15.dist-info}/RECORD +463 -439
- {nautobot-2.4.13.dist-info → nautobot-2.4.15.dist-info}/LICENSE.txt +0 -0
- {nautobot-2.4.13.dist-info → nautobot-2.4.15.dist-info}/NOTICE +0 -0
- {nautobot-2.4.13.dist-info → nautobot-2.4.15.dist-info}/WHEEL +0 -0
- {nautobot-2.4.13.dist-info → nautobot-2.4.15.dist-info}/entry_points.txt +0 -0
|
@@ -52,6 +52,7 @@ from nautobot.extras.models import (
|
|
|
52
52
|
Contact,
|
|
53
53
|
ContactAssociation,
|
|
54
54
|
CustomField,
|
|
55
|
+
CustomFieldChoice,
|
|
55
56
|
CustomLink,
|
|
56
57
|
DynamicGroup,
|
|
57
58
|
ExportTemplate,
|
|
@@ -638,12 +639,16 @@ class CustomFieldTestCase(
|
|
|
638
639
|
ViewTestCases.GetObjectViewTestCase,
|
|
639
640
|
ViewTestCases.GetObjectChangelogViewTestCase,
|
|
640
641
|
ViewTestCases.ListObjectsViewTestCase,
|
|
642
|
+
ViewTestCases.BulkEditObjectsViewTestCase,
|
|
641
643
|
):
|
|
642
644
|
model = CustomField
|
|
643
645
|
slugify_function = staticmethod(slugify_dashes_to_underscores)
|
|
644
646
|
|
|
645
647
|
@classmethod
|
|
646
648
|
def setUpTestData(cls):
|
|
649
|
+
ipaddress_ct = ContentType.objects.get_for_model(IPAddress)
|
|
650
|
+
prefix_ct = ContentType.objects.get_for_model(Prefix)
|
|
651
|
+
device_ct = ContentType.objects.get_for_model(Device)
|
|
647
652
|
obj_type = ContentType.objects.get_for_model(Location)
|
|
648
653
|
|
|
649
654
|
custom_fields = [
|
|
@@ -674,7 +679,7 @@ class CustomFieldTestCase(
|
|
|
674
679
|
|
|
675
680
|
for custom_field in custom_fields:
|
|
676
681
|
custom_field.validated_save()
|
|
677
|
-
custom_field.content_types.set([obj_type])
|
|
682
|
+
custom_field.content_types.set([obj_type, device_ct])
|
|
678
683
|
|
|
679
684
|
cls.form_data = {
|
|
680
685
|
"content_types": [obj_type.pk],
|
|
@@ -691,6 +696,17 @@ class CustomFieldTestCase(
|
|
|
691
696
|
"custom_field_choices-MAX_NUM_FORMS": "1000",
|
|
692
697
|
}
|
|
693
698
|
|
|
699
|
+
cls.bulk_edit_data = {
|
|
700
|
+
"grouping": "Updated Grouping",
|
|
701
|
+
"description": "Updated description for testing bulk edit.",
|
|
702
|
+
"required": True,
|
|
703
|
+
"filter_logic": "loose",
|
|
704
|
+
"weight": 200,
|
|
705
|
+
"advanced_ui": True,
|
|
706
|
+
"add_content_types": [ipaddress_ct.pk, prefix_ct.pk],
|
|
707
|
+
"remove_content_types": [device_ct.pk],
|
|
708
|
+
}
|
|
709
|
+
|
|
694
710
|
def test_create_object_without_permission(self):
|
|
695
711
|
# Can't have two CustomFields with the same "key"
|
|
696
712
|
self.form_data = self.form_data.copy()
|
|
@@ -709,6 +725,161 @@ class CustomFieldTestCase(
|
|
|
709
725
|
self.form_data["key"] = "custom_field_boolean_2"
|
|
710
726
|
super().test_create_object_with_constrained_permission()
|
|
711
727
|
|
|
728
|
+
def test_create_custom_field_with_choices(self):
|
|
729
|
+
"""Ensure a select-type CustomField can be created with multiple valid choices.."""
|
|
730
|
+
self.add_permissions("extras.add_customfield", "extras.view_customfield")
|
|
731
|
+
|
|
732
|
+
content_type = ContentType.objects.get_for_model(Location)
|
|
733
|
+
|
|
734
|
+
form_data = {
|
|
735
|
+
"content_types": [content_type.pk],
|
|
736
|
+
"type": CustomFieldTypeChoices.TYPE_SELECT,
|
|
737
|
+
"key": "select_with_choices",
|
|
738
|
+
"label": "Select Field with Choices",
|
|
739
|
+
"default": "",
|
|
740
|
+
"filter_logic": "loose",
|
|
741
|
+
"weight": 100,
|
|
742
|
+
"custom_field_choices-TOTAL_FORMS": "2",
|
|
743
|
+
"custom_field_choices-INITIAL_FORMS": "0",
|
|
744
|
+
"custom_field_choices-MIN_NUM_FORMS": "0",
|
|
745
|
+
"custom_field_choices-MAX_NUM_FORMS": "1000",
|
|
746
|
+
"custom_field_choices-0-value": "Option A",
|
|
747
|
+
"custom_field_choices-0-weight": "100",
|
|
748
|
+
"custom_field_choices-1-value": "Option B",
|
|
749
|
+
"custom_field_choices-1-weight": "200",
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
response = self.client.post(reverse("extras:customfield_add"), data=form_data, follow=True)
|
|
753
|
+
|
|
754
|
+
self.assertEqual(response.status_code, 200)
|
|
755
|
+
self.assertTrue(CustomField.objects.filter(key="select_with_choices").exists())
|
|
756
|
+
|
|
757
|
+
field = CustomField.objects.get(key="select_with_choices")
|
|
758
|
+
self.assertEqual(field.custom_field_choices.count(), 2)
|
|
759
|
+
self.assertSetEqual(
|
|
760
|
+
set(field.custom_field_choices.values_list("value", flat=True)),
|
|
761
|
+
{"Option A", "Option B"},
|
|
762
|
+
)
|
|
763
|
+
|
|
764
|
+
def test_update_select_custom_field_add_choice(self):
|
|
765
|
+
"""Test that submitting the edit form with both existing and new choices
|
|
766
|
+
results in the new choice being saved correctly."""
|
|
767
|
+
self.add_permissions("extras.change_customfield", "extras.view_customfield")
|
|
768
|
+
|
|
769
|
+
content_type = ContentType.objects.get_for_model(Location)
|
|
770
|
+
field = CustomField.objects.create(
|
|
771
|
+
type=CustomFieldTypeChoices.TYPE_SELECT,
|
|
772
|
+
label="Editable Select Field",
|
|
773
|
+
key="editable_select_field",
|
|
774
|
+
)
|
|
775
|
+
field.content_types.set([content_type])
|
|
776
|
+
|
|
777
|
+
# Added initial choice
|
|
778
|
+
initial_choice = CustomFieldChoice.objects.create(
|
|
779
|
+
custom_field=field,
|
|
780
|
+
value="Initial Option",
|
|
781
|
+
weight=100,
|
|
782
|
+
)
|
|
783
|
+
|
|
784
|
+
url = reverse("extras:customfield_edit", args=[field.pk])
|
|
785
|
+
form_data = {
|
|
786
|
+
"content_types": [content_type.pk],
|
|
787
|
+
"type": field.type,
|
|
788
|
+
"key": field.key,
|
|
789
|
+
"label": field.label,
|
|
790
|
+
"default": "",
|
|
791
|
+
"filter_logic": "loose",
|
|
792
|
+
"weight": 100,
|
|
793
|
+
"custom_field_choices-TOTAL_FORMS": "2",
|
|
794
|
+
"custom_field_choices-INITIAL_FORMS": "1",
|
|
795
|
+
"custom_field_choices-MIN_NUM_FORMS": "0",
|
|
796
|
+
"custom_field_choices-MAX_NUM_FORMS": "1000",
|
|
797
|
+
"custom_field_choices-0-id": initial_choice.pk,
|
|
798
|
+
"custom_field_choices-0-value": "Initial Option",
|
|
799
|
+
"custom_field_choices-0-weight": "100",
|
|
800
|
+
"custom_field_choices-1-value": "New Option",
|
|
801
|
+
"custom_field_choices-1-weight": "200",
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
response = self.client.post(url, data=form_data, follow=True)
|
|
805
|
+
self.assertEqual(response.status_code, 200)
|
|
806
|
+
self.assertEqual(field.custom_field_choices.count(), 2)
|
|
807
|
+
self.assertTrue(field.custom_field_choices.filter(value="New Option").exists())
|
|
808
|
+
|
|
809
|
+
def test_update_select_custom_field_remove_choice(self):
|
|
810
|
+
"""Test removing a choice from a select field."""
|
|
811
|
+
self.add_permissions("extras.change_customfield", "extras.view_customfield")
|
|
812
|
+
|
|
813
|
+
content_type = ContentType.objects.get_for_model(Location)
|
|
814
|
+
field = CustomField.objects.create(
|
|
815
|
+
type=CustomFieldTypeChoices.TYPE_SELECT,
|
|
816
|
+
label="Deletable Select Field",
|
|
817
|
+
key="deletable_select_field",
|
|
818
|
+
)
|
|
819
|
+
field.content_types.set([content_type])
|
|
820
|
+
|
|
821
|
+
choice = CustomFieldChoice.objects.create(
|
|
822
|
+
custom_field=field,
|
|
823
|
+
value="Choice To Delete",
|
|
824
|
+
weight=100,
|
|
825
|
+
)
|
|
826
|
+
|
|
827
|
+
url = reverse("extras:customfield_edit", args=[field.pk])
|
|
828
|
+
form_data = {
|
|
829
|
+
"content_types": [content_type.pk],
|
|
830
|
+
"type": field.type,
|
|
831
|
+
"key": field.key,
|
|
832
|
+
"label": field.label,
|
|
833
|
+
"default": "",
|
|
834
|
+
"filter_logic": "loose",
|
|
835
|
+
"weight": 100,
|
|
836
|
+
"custom_field_choices-TOTAL_FORMS": "1",
|
|
837
|
+
"custom_field_choices-INITIAL_FORMS": "1",
|
|
838
|
+
"custom_field_choices-MIN_NUM_FORMS": "0",
|
|
839
|
+
"custom_field_choices-MAX_NUM_FORMS": "1000",
|
|
840
|
+
"custom_field_choices-0-id": choice.pk,
|
|
841
|
+
"custom_field_choices-0-value": choice.value,
|
|
842
|
+
"custom_field_choices-0-weight": choice.weight,
|
|
843
|
+
"custom_field_choices-0-DELETE": "on",
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
response = self.client.post(url, data=form_data, follow=True)
|
|
847
|
+
self.assertEqual(response.status_code, 200)
|
|
848
|
+
self.assertEqual(field.custom_field_choices.count(), 0)
|
|
849
|
+
|
|
850
|
+
def test_create_custom_field_with_invalid_choice_data(self):
|
|
851
|
+
"""Ensure invalid choice formset blocks saving."""
|
|
852
|
+
self.add_permissions("extras.add_customfield", "extras.view_customfield")
|
|
853
|
+
|
|
854
|
+
content_type = ContentType.objects.get_for_model(Location)
|
|
855
|
+
|
|
856
|
+
form_data = {
|
|
857
|
+
"content_types": [content_type.pk],
|
|
858
|
+
"type": CustomFieldTypeChoices.TYPE_SELECT,
|
|
859
|
+
"key": "invalid_choice_field",
|
|
860
|
+
"label": "Field with Invalid Choice",
|
|
861
|
+
"default": "",
|
|
862
|
+
"filter_logic": "loose",
|
|
863
|
+
"weight": 100,
|
|
864
|
+
"custom_field_choices-TOTAL_FORMS": "1",
|
|
865
|
+
"custom_field_choices-INITIAL_FORMS": "0",
|
|
866
|
+
"custom_field_choices-MIN_NUM_FORMS": "0",
|
|
867
|
+
"custom_field_choices-MAX_NUM_FORMS": "1000",
|
|
868
|
+
# Invalid: missing weight, empty value
|
|
869
|
+
"custom_field_choices-0-value": "",
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
response = self.client.post(reverse("extras:customfield_add"), data=form_data)
|
|
873
|
+
|
|
874
|
+
self.assertEqual(response.status_code, 200)
|
|
875
|
+
self.assertFalse(CustomField.objects.filter(key="invalid_choice_field").exists())
|
|
876
|
+
self.assertFormsetError(
|
|
877
|
+
response.context["choices"], form_index=0, field="value", errors=["This field is required."]
|
|
878
|
+
)
|
|
879
|
+
self.assertFormsetError(
|
|
880
|
+
response.context["choices"], form_index=0, field="weight", errors=["This field is required."]
|
|
881
|
+
)
|
|
882
|
+
|
|
712
883
|
|
|
713
884
|
class CustomLinkRenderingTestCase(TestCase):
|
|
714
885
|
"""Tests for the inclusion of CustomLinks, distinct from tests of the CustomLink views themselves."""
|
|
@@ -1850,8 +2021,18 @@ class SecretTestCase(
|
|
|
1850
2021
|
}
|
|
1851
2022
|
|
|
1852
2023
|
|
|
1853
|
-
class SecretsGroupTestCase(
|
|
2024
|
+
class SecretsGroupTestCase(
|
|
2025
|
+
ViewTestCases.OrganizationalObjectViewTestCase,
|
|
2026
|
+
ViewTestCases.BulkEditObjectsViewTestCase,
|
|
2027
|
+
):
|
|
1854
2028
|
model = SecretsGroup
|
|
2029
|
+
custom_test_permissions = [
|
|
2030
|
+
"extras.view_secret",
|
|
2031
|
+
"extras.add_secretsgroup",
|
|
2032
|
+
"extras.view_secretsgroup",
|
|
2033
|
+
"extras.add_secretsgroupassociation",
|
|
2034
|
+
"extras.change_secretsgroupassociation",
|
|
2035
|
+
]
|
|
1855
2036
|
|
|
1856
2037
|
@classmethod
|
|
1857
2038
|
def setUpTestData(cls):
|
|
@@ -1895,6 +2076,108 @@ class SecretsGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|
|
1895
2076
|
"secrets_group_associations-MIN_NUM_FORMS": "0",
|
|
1896
2077
|
"secrets_group_associations-MAX_NUM_FORMS": "1000",
|
|
1897
2078
|
}
|
|
2079
|
+
cls.bulk_edit_data = {
|
|
2080
|
+
"description": "This is a very detailed new description",
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
def test_create_group_with_valid_secret_association(self):
|
|
2084
|
+
"""Test that a SecretsGroup with a valid Secret association saves correctly via the formset."""
|
|
2085
|
+
self.add_permissions(*self.custom_test_permissions)
|
|
2086
|
+
# Create a secret to associate
|
|
2087
|
+
secret = Secret.objects.create(
|
|
2088
|
+
name="AWS_Secret",
|
|
2089
|
+
provider="text-file",
|
|
2090
|
+
parameters={"path": "/tmp"}, # noqa: S108 # hardcoded-temp-file -- false positive
|
|
2091
|
+
)
|
|
2092
|
+
|
|
2093
|
+
form_data = {
|
|
2094
|
+
"name": "test",
|
|
2095
|
+
"description": "test bulk edits",
|
|
2096
|
+
"secrets_group_associations-TOTAL_FORMS": "1",
|
|
2097
|
+
"secrets_group_associations-INITIAL_FORMS": "0",
|
|
2098
|
+
"secrets_group_associations-MIN_NUM_FORMS": "0",
|
|
2099
|
+
"secrets_group_associations-MAX_NUM_FORMS": "1000",
|
|
2100
|
+
"secrets_group_associations-0-secret": secret.pk,
|
|
2101
|
+
"secrets_group_associations-0-access_type": SecretsGroupAccessTypeChoices.TYPE_HTTP,
|
|
2102
|
+
"secrets_group_associations-0-secret_type": SecretsGroupSecretTypeChoices.TYPE_PASSWORD,
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
# Submit the form to the "add SecretsGroup" view
|
|
2106
|
+
response = self.client.post(reverse("extras:secretsgroup_add"), data=form_data, follow=True)
|
|
2107
|
+
|
|
2108
|
+
self.assertEqual(response.status_code, 200)
|
|
2109
|
+
self.assertTrue(SecretsGroup.objects.filter(name="test").exists())
|
|
2110
|
+
|
|
2111
|
+
# Checks that the association was created correctly
|
|
2112
|
+
group = SecretsGroup.objects.get(name="test")
|
|
2113
|
+
self.assertEqual(group.secrets_group_associations.count(), 1)
|
|
2114
|
+
|
|
2115
|
+
association = group.secrets_group_associations.first()
|
|
2116
|
+
self.assertEqual(association.secret, secret)
|
|
2117
|
+
self.assertEqual(association.access_type, SecretsGroupAccessTypeChoices.TYPE_HTTP)
|
|
2118
|
+
self.assertEqual(association.secret_type, SecretsGroupSecretTypeChoices.TYPE_PASSWORD)
|
|
2119
|
+
|
|
2120
|
+
def test_create_group_with_invalid_secret_association(self):
|
|
2121
|
+
"""Test that invalid Secret association formset raises validation error and does not save."""
|
|
2122
|
+
self.add_permissions(*self.custom_test_permissions)
|
|
2123
|
+
url = reverse("extras:secretsgroup_add")
|
|
2124
|
+
|
|
2125
|
+
form_data = {
|
|
2126
|
+
"name": "Invalid Secrets Group",
|
|
2127
|
+
"description": "Missing required fields",
|
|
2128
|
+
"secrets_group_associations-TOTAL_FORMS": "1",
|
|
2129
|
+
"secrets_group_associations-INITIAL_FORMS": "0",
|
|
2130
|
+
"secrets_group_associations-MIN_NUM_FORMS": "0",
|
|
2131
|
+
"secrets_group_associations-MAX_NUM_FORMS": "1000",
|
|
2132
|
+
"secrets_group_associations-0-secret": "", # invalid
|
|
2133
|
+
"secrets_group_associations-0-access_type": SecretsGroupAccessTypeChoices.TYPE_HTTP,
|
|
2134
|
+
"secrets_group_associations-0-secret_type": "", # invalid
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
response = self.client.post(url, data=form_data)
|
|
2138
|
+
|
|
2139
|
+
self.assertEqual(response.status_code, 200)
|
|
2140
|
+
|
|
2141
|
+
# Checks that no new SecretsGroup was created
|
|
2142
|
+
self.assertFalse(SecretsGroup.objects.filter(name="Invalid Secrets Group").exists())
|
|
2143
|
+
|
|
2144
|
+
# Checks that formset errors are raised in the context
|
|
2145
|
+
self.assertFormsetError(
|
|
2146
|
+
response.context["secrets"], form_index=0, field="secret", errors=["This field is required."]
|
|
2147
|
+
)
|
|
2148
|
+
|
|
2149
|
+
def test_create_group_with_deleted_secret_fails_cleanly(self):
|
|
2150
|
+
"""
|
|
2151
|
+
Creating a SecretsGroup with a deleted Secret should fail with a formset error.
|
|
2152
|
+
"""
|
|
2153
|
+
self.add_permissions(*self.custom_test_permissions)
|
|
2154
|
+
|
|
2155
|
+
secret = Secret.objects.create(name="TempSecret", provider="text-file", parameters={"path": "/tmp"}) # noqa: S108 # hardcoded-temp-file -- false positive
|
|
2156
|
+
secret_pk = secret.pk
|
|
2157
|
+
secret.delete()
|
|
2158
|
+
|
|
2159
|
+
form_data = {
|
|
2160
|
+
"name": "Test Group",
|
|
2161
|
+
"description": "This should not be created",
|
|
2162
|
+
"secrets_group_associations-TOTAL_FORMS": "1",
|
|
2163
|
+
"secrets_group_associations-INITIAL_FORMS": "0",
|
|
2164
|
+
"secrets_group_associations-MIN_NUM_FORMS": "0",
|
|
2165
|
+
"secrets_group_associations-MAX_NUM_FORMS": "1000",
|
|
2166
|
+
"secrets_group_associations-0-secret": secret_pk,
|
|
2167
|
+
"secrets_group_associations-0-access_type": SecretsGroupAccessTypeChoices.TYPE_HTTP,
|
|
2168
|
+
"secrets_group_associations-0-secret_type": SecretsGroupSecretTypeChoices.TYPE_PASSWORD,
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
response = self.client.post(reverse("extras:secretsgroup_add"), data=form_data)
|
|
2172
|
+
self.assertEqual(response.status_code, 200)
|
|
2173
|
+
|
|
2174
|
+
self.assertFormsetError(
|
|
2175
|
+
response.context["secrets"],
|
|
2176
|
+
form_index=0,
|
|
2177
|
+
field="secret",
|
|
2178
|
+
errors=["Select a valid choice. That choice is not one of the available choices."],
|
|
2179
|
+
)
|
|
2180
|
+
self.assertFalse(SecretsGroup.objects.filter(name="Test Group").exists())
|
|
1898
2181
|
|
|
1899
2182
|
|
|
1900
2183
|
class GraphQLQueriesTestCase(
|
nautobot/extras/urls.py
CHANGED
|
@@ -3,14 +3,10 @@ from django.urls import path
|
|
|
3
3
|
from nautobot.core.views.routers import NautobotUIViewSetRouter
|
|
4
4
|
from nautobot.extras import views
|
|
5
5
|
from nautobot.extras.models import (
|
|
6
|
-
CustomField,
|
|
7
6
|
DynamicGroup,
|
|
8
7
|
GitRepository,
|
|
9
|
-
GraphQLQuery,
|
|
10
8
|
Job,
|
|
11
|
-
Note,
|
|
12
9
|
Relationship,
|
|
13
|
-
SecretsGroup,
|
|
14
10
|
)
|
|
15
11
|
|
|
16
12
|
app_name = "extras"
|
|
@@ -21,19 +17,24 @@ router.register("config-context-schemas", views.ConfigContextSchemaUIViewSet)
|
|
|
21
17
|
router.register("config-contexts", views.ConfigContextUIViewSet)
|
|
22
18
|
router.register("contacts", views.ContactUIViewSet)
|
|
23
19
|
router.register("contact-associations", views.ContactAssociationUIViewSet)
|
|
20
|
+
router.register("custom-fields", views.CustomFieldUIViewSet)
|
|
24
21
|
router.register("custom-links", views.CustomLinkUIViewSet)
|
|
25
22
|
router.register("export-templates", views.ExportTemplateUIViewSet)
|
|
26
23
|
router.register("external-integrations", views.ExternalIntegrationUIViewSet)
|
|
24
|
+
router.register("graphql-queries", views.GraphQLQueryUIViewSet)
|
|
27
25
|
router.register("job-buttons", views.JobButtonUIViewSet)
|
|
28
26
|
router.register("job-hooks", views.JobHookUIViewSet)
|
|
29
27
|
router.register("job-queues", views.JobQueueUIViewSet)
|
|
28
|
+
router.register("job-results", views.JobResultUIViewSet)
|
|
30
29
|
router.register("metadata-types", views.MetadataTypeUIViewSet)
|
|
30
|
+
router.register("notes", views.NoteUIViewSet)
|
|
31
31
|
router.register("object-metadata", views.ObjectMetadataUIViewSet)
|
|
32
32
|
router.register("relationship-associations", views.RelationshipAssociationUIViewSet)
|
|
33
33
|
router.register("relationships", views.RelationshipUIViewSet)
|
|
34
34
|
router.register("roles", views.RoleUIViewSet)
|
|
35
35
|
router.register("saved-views", views.SavedViewUIViewSet)
|
|
36
36
|
router.register("secrets", views.SecretUIViewSet)
|
|
37
|
+
router.register("secrets-groups", views.SecretsGroupUIViewSet)
|
|
37
38
|
router.register("static-group-associations", views.StaticGroupAssociationUIViewSet)
|
|
38
39
|
router.register("statuses", views.StatusUIViewSet)
|
|
39
40
|
router.register("tags", views.TagUIViewSet)
|
|
@@ -58,37 +59,6 @@ urlpatterns = [
|
|
|
58
59
|
views.ObjectAssignContactOrTeamView.as_view(),
|
|
59
60
|
name="object_contact_team_assign",
|
|
60
61
|
),
|
|
61
|
-
# Custom fields
|
|
62
|
-
path("custom-fields/", views.CustomFieldListView.as_view(), name="customfield_list"),
|
|
63
|
-
path("custom-fields/add/", views.CustomFieldEditView.as_view(), name="customfield_add"),
|
|
64
|
-
path(
|
|
65
|
-
"custom-fields/delete/",
|
|
66
|
-
views.CustomFieldBulkDeleteView.as_view(),
|
|
67
|
-
name="customfield_bulk_delete",
|
|
68
|
-
),
|
|
69
|
-
path("custom-fields/<uuid:pk>/", views.CustomFieldView.as_view(), name="customfield"),
|
|
70
|
-
path(
|
|
71
|
-
"custom-fields/<uuid:pk>/edit/",
|
|
72
|
-
views.CustomFieldEditView.as_view(),
|
|
73
|
-
name="customfield_edit",
|
|
74
|
-
),
|
|
75
|
-
path(
|
|
76
|
-
"custom-fields/<uuid:pk>/delete/",
|
|
77
|
-
views.CustomFieldDeleteView.as_view(),
|
|
78
|
-
name="customfield_delete",
|
|
79
|
-
),
|
|
80
|
-
path(
|
|
81
|
-
"custom-fields/<uuid:pk>/changelog/",
|
|
82
|
-
views.ObjectChangeLogView.as_view(),
|
|
83
|
-
name="customfield_changelog",
|
|
84
|
-
kwargs={"model": CustomField},
|
|
85
|
-
),
|
|
86
|
-
path(
|
|
87
|
-
"custom-fields/<uuid:pk>/notes/",
|
|
88
|
-
views.ObjectNotesView.as_view(),
|
|
89
|
-
name="customfield_notes",
|
|
90
|
-
kwargs={"model": CustomField},
|
|
91
|
-
),
|
|
92
62
|
# Dynamic Groups
|
|
93
63
|
path("dynamic-groups/", views.DynamicGroupListView.as_view(), name="dynamicgroup_list"),
|
|
94
64
|
path("dynamic-groups/add/", views.DynamicGroupEditView.as_view(), name="dynamicgroup_add"),
|
|
@@ -181,37 +151,6 @@ urlpatterns = [
|
|
|
181
151
|
views.GitRepositoryDryRunView.as_view(),
|
|
182
152
|
name="gitrepository_dryrun",
|
|
183
153
|
),
|
|
184
|
-
# GraphQL Queries
|
|
185
|
-
path("graphql-queries/", views.GraphQLQueryListView.as_view(), name="graphqlquery_list"),
|
|
186
|
-
path("graphql-queries/add/", views.GraphQLQueryEditView.as_view(), name="graphqlquery_add"),
|
|
187
|
-
path(
|
|
188
|
-
"graphql-queries/delete/",
|
|
189
|
-
views.GraphQLQueryBulkDeleteView.as_view(),
|
|
190
|
-
name="GraphQLQuery_bulk_delete",
|
|
191
|
-
),
|
|
192
|
-
path("graphql-queries/<uuid:pk>/", views.GraphQLQueryView.as_view(), name="graphqlquery"),
|
|
193
|
-
path(
|
|
194
|
-
"graphql-queries/<uuid:pk>/edit/",
|
|
195
|
-
views.GraphQLQueryEditView.as_view(),
|
|
196
|
-
name="graphqlquery_edit",
|
|
197
|
-
),
|
|
198
|
-
path(
|
|
199
|
-
"graphql-queries/<uuid:pk>/delete/",
|
|
200
|
-
views.GraphQLQueryDeleteView.as_view(),
|
|
201
|
-
name="graphqlquery_delete",
|
|
202
|
-
),
|
|
203
|
-
path(
|
|
204
|
-
"graphql-queries/<uuid:pk>/changelog/",
|
|
205
|
-
views.ObjectChangeLogView.as_view(),
|
|
206
|
-
name="graphqlquery_changelog",
|
|
207
|
-
kwargs={"model": GraphQLQuery},
|
|
208
|
-
),
|
|
209
|
-
path(
|
|
210
|
-
"graphql-queries/<uuid:pk>/notes/",
|
|
211
|
-
views.ObjectNotesView.as_view(),
|
|
212
|
-
name="graphqlquery_notes",
|
|
213
|
-
kwargs={"model": GraphQLQuery},
|
|
214
|
-
),
|
|
215
154
|
# Image attachments
|
|
216
155
|
path(
|
|
217
156
|
"image-attachments/<uuid:pk>/edit/",
|
|
@@ -266,32 +205,6 @@ urlpatterns = [
|
|
|
266
205
|
path("jobs/<str:class_path>/run/", views.JobRunView.as_view(), name="job_run_by_class_path"),
|
|
267
206
|
path("jobs/edit/", views.JobBulkEditView.as_view(), name="job_bulk_edit"),
|
|
268
207
|
path("jobs/delete/", views.JobBulkDeleteView.as_view(), name="job_bulk_delete"),
|
|
269
|
-
# Generic job results
|
|
270
|
-
path("job-results/", views.JobResultListView.as_view(), name="jobresult_list"),
|
|
271
|
-
path("job-results/<uuid:pk>/", views.JobResultView.as_view(), name="jobresult"),
|
|
272
|
-
path("job-results/<uuid:pk>/log-table/", views.JobLogEntryTableView.as_view(), name="jobresult_log-table"),
|
|
273
|
-
path(
|
|
274
|
-
"job-results/delete/",
|
|
275
|
-
views.JobResultBulkDeleteView.as_view(),
|
|
276
|
-
name="jobresult_bulk_delete",
|
|
277
|
-
),
|
|
278
|
-
path(
|
|
279
|
-
"job-results/<uuid:pk>/delete/",
|
|
280
|
-
views.JobResultDeleteView.as_view(),
|
|
281
|
-
name="jobresult_delete",
|
|
282
|
-
),
|
|
283
|
-
# Notes
|
|
284
|
-
path("notes/", views.NoteListView.as_view(), name="note_list"),
|
|
285
|
-
path("notes/add/", views.NoteEditView.as_view(), name="note_add"),
|
|
286
|
-
path("notes/<uuid:pk>/", views.NoteView.as_view(), name="note"),
|
|
287
|
-
path(
|
|
288
|
-
"notes/<uuid:pk>/changelog/",
|
|
289
|
-
views.ObjectChangeLogView.as_view(),
|
|
290
|
-
name="note_changelog",
|
|
291
|
-
kwargs={"model": Note},
|
|
292
|
-
),
|
|
293
|
-
path("notes/<uuid:pk>/edit/", views.NoteEditView.as_view(), name="note_edit"),
|
|
294
|
-
path("notes/<uuid:pk>/delete/", views.NoteDeleteView.as_view(), name="note_delete"),
|
|
295
208
|
# Custom relationships
|
|
296
209
|
path(
|
|
297
210
|
"relationships/<uuid:pk>/changelog/",
|
|
@@ -311,24 +224,6 @@ urlpatterns = [
|
|
|
311
224
|
views.SecretProviderParametersFormView.as_view(),
|
|
312
225
|
name="secret_provider_parameters_form",
|
|
313
226
|
),
|
|
314
|
-
path("secrets-groups/", views.SecretsGroupListView.as_view(), name="secretsgroup_list"),
|
|
315
|
-
path("secrets-groups/add/", views.SecretsGroupEditView.as_view(), name="secretsgroup_add"),
|
|
316
|
-
path("secrets-groups/delete/", views.SecretsGroupBulkDeleteView.as_view(), name="secretsgroup_bulk_delete"),
|
|
317
|
-
path("secrets-groups/<uuid:pk>/", views.SecretsGroupView.as_view(), name="secretsgroup"),
|
|
318
|
-
path("secrets-groups/<uuid:pk>/edit/", views.SecretsGroupEditView.as_view(), name="secretsgroup_edit"),
|
|
319
|
-
path("secrets-groups/<uuid:pk>/delete/", views.SecretsGroupDeleteView.as_view(), name="secretsgroup_delete"),
|
|
320
|
-
path(
|
|
321
|
-
"secrets-groups/<uuid:pk>/changelog/",
|
|
322
|
-
views.ObjectChangeLogView.as_view(),
|
|
323
|
-
name="secretsgroup_changelog",
|
|
324
|
-
kwargs={"model": SecretsGroup},
|
|
325
|
-
),
|
|
326
|
-
path(
|
|
327
|
-
"secrets-groups/<uuid:pk>/notes/",
|
|
328
|
-
views.ObjectNotesView.as_view(),
|
|
329
|
-
name="secretsgroup_notes",
|
|
330
|
-
kwargs={"model": SecretsGroup},
|
|
331
|
-
),
|
|
332
227
|
]
|
|
333
228
|
|
|
334
229
|
urlpatterns += router.urls
|
nautobot/extras/utils.py
CHANGED
|
@@ -275,11 +275,14 @@ def extras_features(*features):
|
|
|
275
275
|
"""
|
|
276
276
|
|
|
277
277
|
def wrapper(model_class):
|
|
278
|
-
# Initialize the model_features
|
|
278
|
+
# Initialize the model_features and feature_models stores if not already defined
|
|
279
279
|
if "model_features" not in registry:
|
|
280
280
|
registry["model_features"] = {f: collections.defaultdict(list) for f in EXTRAS_FEATURES}
|
|
281
|
+
if "feature_models" not in registry:
|
|
282
|
+
registry["feature_models"] = {f: [] for f in EXTRAS_FEATURES}
|
|
281
283
|
for feature in features:
|
|
282
284
|
if feature in EXTRAS_FEATURES:
|
|
285
|
+
registry["feature_models"][feature].append(model_class)
|
|
283
286
|
app_label, model_name = model_class._meta.label_lower.split(".")
|
|
284
287
|
registry["model_features"][feature][app_label].append(model_name)
|
|
285
288
|
else:
|
|
@@ -489,7 +492,7 @@ def task_queues_as_choices(task_queues):
|
|
|
489
492
|
worker_count = celery_queues.get(settings.CELERY_TASK_DEFAULT_QUEUE, 0)
|
|
490
493
|
else:
|
|
491
494
|
worker_count = celery_queues.get(queue, 0)
|
|
492
|
-
description = f"{queue if queue else 'default queue'} ({worker_count} worker{'s'[:worker_count^1]})"
|
|
495
|
+
description = f"{queue if queue else 'default queue'} ({worker_count} worker{'s'[: worker_count ^ 1]})"
|
|
493
496
|
choices.append((queue, description))
|
|
494
497
|
return choices
|
|
495
498
|
|