From bcb06ac098a3b1418b7fe697c87d4487b501a54f Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Wed, 8 Nov 2023 10:38:00 -0600 Subject: [PATCH 01/15] initial commit on v2 conversion --- nautobot-app/cookiecutter.json | 4 +- .../development/docker-compose.base.yml | 3 +- .../{{cookiecutter.plugin_name}}/__init__.py | 2 +- .../api/nested_serializers.py | 18 ---- .../api/serializers.py | 10 +- .../{{cookiecutter.plugin_name}}/api/urls.py | 4 +- .../{{cookiecutter.plugin_name}}/api/views.py | 5 +- .../{{cookiecutter.plugin_name}}/filters.py | 6 +- .../{{cookiecutter.plugin_name}}/forms.py | 31 ++---- .../{{cookiecutter.plugin_name}}/models.py | 11 +- .../navigation.py | 18 ++-- .../{{cookiecutter.plugin_name}}/tables.py | 2 +- ...kiecutter.model_class_name | lower }}.html | 101 ------------------ ....model_class_name | lower }}_retrieve.html | 26 +++++ .../tests/fixtures.py | 6 +- .../tests/test_api_views.py | 6 +- ...ookiecutter.model_class_name | lower }}.py | 2 - ...ookiecutter.model_class_name | lower }}.py | 6 +- .../tests/test_views.py | 18 +--- .../{{cookiecutter.plugin_name}}/urls.py | 30 ++---- .../{{cookiecutter.plugin_name}}/views.py | 18 ++++ ...ookiecutter.model_class_name | lower }}.py | 63 ----------- 22 files changed, 94 insertions(+), 296 deletions(-) delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html create mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html create mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app/cookiecutter.json b/nautobot-app/cookiecutter.json index 641e9912..1098f9b9 100644 --- a/nautobot-app/cookiecutter.json +++ b/nautobot-app/cookiecutter.json @@ -9,8 +9,8 @@ "project_slug": "nautobot-plugin-{{cookiecutter.plugin_slug}}", "repo_url": "https://github.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}", "base_url": "{{cookiecutter.plugin_slug}}", - "min_nautobot_version": "1.6.0", - "max_nautobot_version": "1.9999", + "min_nautobot_version": "2.0.0", + "max_nautobot_version": "2.9999", "camel_name": "{{cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '')}}", "project_short_description": "{{cookiecutter.verbose_name}}", "model_class_name": "None", diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.base.yml b/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.base.yml index 8ab8e986..58ce8438 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.base.yml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.base.yml @@ -45,7 +45,8 @@ services: - "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env - "nautobot-server celery beat -l $$NAUTOBOT_LOG_LEVEL" ## $$ because of docker-compose depends_on: - - "nautobot" + nautobot: + condition: "service_healthy" healthcheck: disable: true <<: *nautobot-base diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py index 585f8e9c..79dfcfde 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py @@ -4,7 +4,7 @@ __version__ = metadata.version(__name__) -from nautobot.extras.plugins import NautobotAppConfig +from nautobot.apps import NautobotAppConfig class {{cookiecutter.camel_name}}Config(NautobotAppConfig): diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py deleted file mode 100644 index 198c4937..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py +++ /dev/null @@ -1,18 +0,0 @@ -"""API nested serializers for {{ cookiecutter.plugin_name }}.""" -from rest_framework import serializers - -from nautobot.core.api import WritableNestedSerializer - -from {{ cookiecutter.plugin_name }} import models - - -class {{ cookiecutter.model_class_name }}NestedSerializer(WritableNestedSerializer): - """{{ cookiecutter.model_class_name }} Nested Serializer.""" - - url = serializers.HyperlinkedIdentityField(view_name="plugins-api:{{ cookiecutter.plugin_name }}-api:{{ cookiecutter.model_class_name | lower }}-detail") - - class Meta: - """Meta attributes.""" - - model = models.{{ cookiecutter.model_class_name }} - fields = "__all__" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py index 1c29b462..b11a267d 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py @@ -1,18 +1,12 @@ """API serializers for {{ cookiecutter.plugin_name }}.""" -from rest_framework import serializers - -from nautobot.core.api.serializers import ValidatedModelSerializer +from nautobot.apps.api import NautobotModelSerializer, TaggedModelSerializerMixin from {{ cookiecutter.plugin_name }} import models -from . import nested_serializers # noqa: F401, pylint: disable=unused-import - -class {{ cookiecutter.model_class_name }}Serializer(ValidatedModelSerializer): +class {{ cookiecutter.model_class_name }}Serializer(NautobotModelSerializer, TaggedModelSerializerMixin): """{{ cookiecutter.model_class_name }} Serializer.""" - url = serializers.HyperlinkedIdentityField(view_name="plugins-api:{{ cookiecutter.plugin_name }}-api:{{ cookiecutter.model_class_name | lower }}-detail") - class Meta: """Meta attributes.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py index 3c956234..fbda22a7 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py @@ -1,6 +1,6 @@ """Django API urlpatterns declaration for {{ cookiecutter.plugin_name }} plugin.""" -from nautobot.core.api import OrderedDefaultRouter +from nautobot.apps.api import OrderedDefaultRouter from {{ cookiecutter.plugin_name }}.api import views @@ -8,6 +8,4 @@ # add the name of your api endpoint, usually hyphenated model name in plural, e.g. "my-model-classes" router.register("{{ cookiecutter.model_class_name.lower() }}", views.{{ cookiecutter.model_class_name }}ViewSet) - -app_name = "{{ cookiecutter.plugin_name }}-api" urlpatterns = router.urls diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py index 67c9f920..168df2f6 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py @@ -1,13 +1,12 @@ """API views for {{ cookiecutter.plugin_name }}.""" -from nautobot.core.api.views import ModelViewSet +from nautobot.apps.api import NautobotModelViewSet from {{cookiecutter.plugin_name }} import filters, models - from {{ cookiecutter.plugin_name }}.api import serializers -class {{ cookiecutter.model_class_name }}ViewSet(ModelViewSet): # pylint: disable=too-many-ancestors +class {{ cookiecutter.model_class_name }}ViewSet(NautobotModelViewSet): # pylint: disable=too-many-ancestors """{{ cookiecutter.model_class_name }} viewset.""" queryset = models.{{ cookiecutter.model_class_name }}.objects.all() diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py index 0f210a98..a50b6e03 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py @@ -1,11 +1,11 @@ """Filtering for {{ cookiecutter.plugin_name }}.""" -from nautobot.utilities.filters import BaseFilterSet, NameSlugSearchFilterSet +from nautobot.apps.filters import NautobotFilterSet from {{ cookiecutter.plugin_name }} import models -class {{ cookiecutter.model_class_name }}FilterSet(BaseFilterSet, NameSlugSearchFilterSet): +class {{ cookiecutter.model_class_name }}FilterSet(NautobotFilterSet): """Filter for {{ cookiecutter.model_class_name }}.""" class Meta: @@ -14,4 +14,4 @@ class Meta: model = models.{{ cookiecutter.model_class_name }} # add any fields from the model that you would like to filter your searches by using those - fields = ["id", "name", "slug", "description"] + fields = ["id", "name", "description"] diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py index 60208679..af6ca1da 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py @@ -1,31 +1,24 @@ """Forms for {{ cookiecutter.plugin_name }}.""" from django import forms -from nautobot.utilities.forms import ( - BootstrapMixin, - BulkEditForm, - SlugField, -) +from nautobot.apps.forms import NautobotBulkEditForm, NautobotFilterForm, NautobotModelForm, TagsBulkEditFormMixin from {{ cookiecutter.plugin_name }} import models -class {{ cookiecutter.model_class_name }}Form(BootstrapMixin, forms.ModelForm): +class {{ cookiecutter.model_class_name }}Form(NautobotModelForm): """{{ cookiecutter.model_class_name }} creation/edit form.""" - slug = SlugField() - class Meta: """Meta attributes.""" model = models.{{ cookiecutter.model_class_name }} fields = [ "name", - "slug", "description", ] -class {{ cookiecutter.model_class_name }}BulkEditForm(BootstrapMixin, BulkEditForm): +class {{ cookiecutter.model_class_name }}BulkEditForm(TagsBulkEditFormMixin, NautobotBulkEditForm): """{{ cookiecutter.model_class_name }} bulk edit form.""" pk = forms.ModelMultipleChoiceField(queryset=models.{{ cookiecutter.model_class_name }}.objects.all(), widget=forms.MultipleHiddenInput) @@ -39,25 +32,15 @@ class Meta: ] -class {{ cookiecutter.model_class_name }}FilterForm(BootstrapMixin, forms.ModelForm): +class {{ cookiecutter.model_class_name }}FilterForm(NautobotFilterForm): """Filter form to filter searches.""" + model = models.{{ cookiecutter.model_class_name }} + field_order = ["q", "name"] + q = forms.CharField( required=False, label="Search", help_text="Search within Name or Slug.", ) name = forms.CharField(required=False, label="Name") - slug = forms.CharField(required=False, label="Slug") - - class Meta: - """Meta attributes.""" - - model = models.{{ cookiecutter.model_class_name }} - # Define the fields above for ordering and widget purposes - fields = [ - "q", - "name", - "slug", - "description", - ] diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py index 0cdad60a..00c2c6ed 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py @@ -2,11 +2,9 @@ # Django imports from django.db import models -from django.urls import reverse # Nautobot imports -from nautobot.core.models import BaseModel -from nautobot.extras.models.change_logging import ChangeLoggedModel +from nautobot.apps.models import PrimaryModel # from nautobot.extras.utils import extras_features @@ -17,11 +15,10 @@ # If you want to choose a specific model to overload in your class declaration, please reference the following documentation: # how to chose a database model: https://docs.nautobot.com/projects/core/en/stable/plugins/development/#database-models -class {{ cookiecutter.model_class_name }}(BaseModel, ChangeLoggedModel): +class {{ cookiecutter.model_class_name }}(PrimaryModel): """Base model for {{ cookiecutter.verbose_name }} plugin.""" name = models.CharField(max_length=100, unique=True) - slug = models.SlugField(max_length=100, unique=True) description = models.CharField(max_length=200, blank=True) # additional model fields @@ -36,10 +33,6 @@ class Meta: # Option for fixing plural name (i.e. "Chicken Tenders" vs "Chicken Tendies") # verbose_name_plural = "{{ cookiecutter.verbose_name }}s" - def get_absolute_url(self): - """Return detail view for {{ cookiecutter.model_class_name }}.""" - return reverse("plugins:{{ cookiecutter.plugin_name }}:{{ cookiecutter.model_class_name.lower() }}", args=[self.slug]) - def __str__(self): """Stringify instance.""" return self.name diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py index 6e3ef3cd..79dda102 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py @@ -1,21 +1,25 @@ """Menu items.""" -from nautobot.extras.plugins import PluginMenuButton, PluginMenuItem +from nautobot.apps.ui import NavMenuAddButton, NavMenuGroup, NavMenuItem, NavMenuTab from nautobot.utilities.choices import ButtonColorChoices -menu_items = ( - PluginMenuItem( +items = ( + NavMenuItem( link="plugins:{{ cookiecutter.plugin_name }}:{{ cookiecutter.model_class_name.lower() }}_list", link_text="{{ cookiecutter.verbose_name }}", permissions=["{{ cookiecutter.plugin_name }}.view_{{ cookiecutter.model_class_name.lower() }}"], buttons=( - PluginMenuButton( + NavMenuAddButton( link="plugins:{{ cookiecutter.plugin_name }}:{{ cookiecutter.model_class_name.lower() }}_add", - title="Add", - icon_class="mdi mdi-plus-thick", - color=ButtonColorChoices.GREEN, permissions=["{{ cookiecutter.plugin_name }}.add_{{ cookiecutter.model_class_name.lower() }}"], ), ), ), ) + +menu_items = ( + NavMenuTab( + name="Plugins", + groups=(NavMenuGroup(name="{{cookiecutter.verbose_name}}", items=tuple(items)),), + ), +) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py index 1d73474c..f9e6c8ea 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py @@ -1,7 +1,7 @@ """Tables for {{ cookiecutter.plugin_name }}.""" import django_tables2 as tables -from nautobot.utilities.tables import BaseTable, ButtonsColumn, ToggleColumn +from nautobot.apps.tables import BaseTable, ButtonsColumn, ToggleColumn from {{ cookiecutter.plugin_name }} import models diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html deleted file mode 100644 index 63f0a66f..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html +++ /dev/null @@ -1,101 +0,0 @@ -{% raw %} -{% extends 'generic/object_retrieve.html' %} -{% load buttons %} -{% load static %} -{% load custom_links %} -{% load helpers %} -{% load plugins %} - -{% block title %}{{ object }}{% endblock %} -{% endraw %} - -{% raw %} -{% block header %} -
- -
-
-
- - - - -
-
-
-
-
- {% if perms.{% endraw %}{{ cookiecutter.plugin_name }}.change_{{ cookiecutter.model_class_name.lower() }}{% raw %} %} - - Edit - - {% endif %} - {% if perms.{% endraw %}{{ cookiecutter.plugin_name }}.delete_{{ cookiecutter.model_class_name.lower() }}{% raw %} %} - - Delete - - {% endif %} -
-

{{ object }}

-{% include 'inc/created_updated.html' with obj=object %} -
- {% custom_links object %} -
- -{% endblock %} - -{% block content %} -
-
-
-
- {% endraw %}{{ cookiecutter.model_class_name }}{% raw %} -
- - - - - - - - - -
Name - {{ object.name }} -
Description - {{ object.description|placeholder }} -
-
- {% include 'inc/custom_fields_panel.html' %} - {% include 'inc/relationships_panel.html' %} - {% plugin_left_page object %} -
-
-
-
- {% plugin_full_width_page object %} -
-
-{% endblock %} -{% endraw %} diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html new file mode 100644 index 00000000..3af9df35 --- /dev/null +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html @@ -0,0 +1,26 @@ +{% raw %} +{% extends 'generic/object_retrieve.html' %} +{% load helpers %} + +{% block content_left_page %} +
+
+ {% endraw %}{{ cookiecutter.model_class_name }}{% raw %} +
+ + + + + + + + + +
Name + {{ object.name }} +
Description + {{ object.description|placeholder }} +
+
+{% endblock %} +{% endraw %} diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py index 4e852a21..1bff1dfe 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py @@ -4,6 +4,6 @@ def create_{{ cookiecutter.model_class_name.lower() }}(): """Fixture to create necessary number of {{ cookiecutter.model_class_name }} for tests.""" - {{ cookiecutter.model_class_name }}.objects.create(name="Test One", slug="test-one") - {{ cookiecutter.model_class_name }}.objects.create(name="Test Two", slug="test-two") - {{ cookiecutter.model_class_name }}.objects.create(name="Test Three", slug="test-three") + {{ cookiecutter.model_class_name }}.objects.create(name="Test One") + {{ cookiecutter.model_class_name }}.objects.create(name="Test Two") + {{ cookiecutter.model_class_name }}.objects.create(name="Test Three") diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py index 413419aa..4c7dbf6e 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py @@ -1,5 +1,5 @@ """Unit tests for {{cookiecutter.plugin_name}}.""" -from nautobot.utilities.testing import APIViewTestCases +from nautobot.apps.testing import APIViewTestCases from {{ cookiecutter.plugin_name }} import models from {{ cookiecutter.plugin_name }}.tests import fixtures @@ -13,15 +13,13 @@ class {{ cookiecutter.model_class_name }}APIViewTest(APIViewTestCases.APIViewTes create_data = [ { "name": "Test Model 1", - "slug": "test-model-1", + "description": "test description", }, { "name": "Test Model 2", - "slug": "test-model-2", }, ] bulk_update_data = {"description": "Test Bulk Update"} - brief_fields = ["created", "description", "display", "id", "last_updated", "name", "slug", "url"] @classmethod def setUpTestData(cls): diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py index d6a4ca82..714542fb 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py @@ -11,7 +11,6 @@ def test_specifying_all_fields_success(self): form = forms.{{ cookiecutter.model_class_name }}Form( data={ "name": "Development", - "slug": "development", "description": "Development Testing", } ) @@ -22,7 +21,6 @@ def test_specifying_only_required_success(self): form = forms.{{ cookiecutter.model_class_name }}Form( data={ "name": "Development", - "slug": "development", } ) self.assertTrue(form.is_valid()) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py index b73b3238..f655ad61 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py @@ -10,17 +10,15 @@ class Test{{ cookiecutter.model_class_name }}(TestCase): def test_create_{{ cookiecutter.model_class_name.lower() }}_only_required(self): """Create with only required fields, and validate null description and __str__.""" - {{ cookiecutter.model_class_name.lower() }} = models.{{ cookiecutter.model_class_name }}.objects.create(name="Development", slug="development") + {{ cookiecutter.model_class_name.lower() }} = models.{{ cookiecutter.model_class_name }}.objects.create(name="Development") self.assertEqual({{ cookiecutter.model_class_name.lower() }}.name, "Development") self.assertEqual({{ cookiecutter.model_class_name.lower() }}.description, "") self.assertEqual(str({{ cookiecutter.model_class_name.lower() }}), "Development") - self.assertEqual({{ cookiecutter.model_class_name.lower() }}.slug, "development") def test_create_{{ cookiecutter.model_class_name.lower() }}_all_fields_success(self): """Create {{ cookiecutter.model_class_name }} with all fields.""" {{ cookiecutter.model_class_name.lower() }} = models.{{ cookiecutter.model_class_name }}.objects.create( - name="Development", slug="development", description="Development Test" + name="Development", description="Development Test" ) self.assertEqual({{ cookiecutter.model_class_name.lower() }}.name, "Development") - self.assertEqual({{ cookiecutter.model_class_name.lower() }}.slug, "development") self.assertEqual({{ cookiecutter.model_class_name.lower() }}.description, "Development Test") diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py index 3b8b8d25..bde80696 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py @@ -1,5 +1,5 @@ """Unit tests for views.""" -from nautobot.utilities.testing import ViewTestCases +from nautobot.apps.testing import ViewTestCases from {{ cookiecutter.plugin_name }} import models from {{ cookiecutter.plugin_name }}.tests import fixtures @@ -13,25 +13,9 @@ class {{ cookiecutter.model_class_name }}ViewTest(ViewTestCases.PrimaryObjectVie bulk_edit_data = {"description": "Bulk edit views"} form_data = { "name": "Test 1", - "slug": "test-1", "description": "Initial model", } @classmethod def setUpTestData(cls): fixtures.create_{{ cookiecutter.model_class_name.lower() }}() - - def test_bulk_import_objects_with_constrained_permission(self): - """Auto-generated model does not implement `bulk_import`.""" - - def test_bulk_import_objects_with_permission(self): - """Auto-generated model does not implement `bulk_import`.""" - - def test_bulk_import_objects_without_permission(self): - """Auto-generated model does not implement `bulk_import`.""" - - def test_bulk_import_objects_with_permission_csv_file(self): - """Auto-generated model does not implement `bulk_import`.""" - - def test_has_advanced_tab(self): - """Auto-generated model does not implement an advanced tab.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py index 8003c0e5..324c6e70 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py @@ -1,24 +1,10 @@ -"""Django urlpatterns declaration for {{cookiecutter.plugin_name}} plugin.""" -from django.urls import path -from nautobot.extras.views import ObjectChangeLogView +"""Django urlpatterns declaration for {{ cookiecutter.plugin_name }} plugin.""" +from nautobot.apps.urls import NautobotUIViewSetRouter -from {{ cookiecutter.plugin_name }} import models -from {{ cookiecutter.plugin_name }}.views import {{ cookiecutter.model_class_name.lower() }} +from {{ cookiecutter.plugin_name }} import views -urlpatterns = [ - # {{ cookiecutter.model_class_name }} URLs - path("{{ cookiecutter.model_class_name | lower }}/", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}ListView.as_view(), name="{{ cookiecutter.model_class_name.lower() }}_list"), - # Order is important for these URLs to work (add/delete/edit) to be before any that require uuid/slug - path("{{ cookiecutter.model_class_name | lower }}/add/", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}CreateView.as_view(), name="{{ cookiecutter.model_class_name.lower() }}_add"), - path("{{ cookiecutter.model_class_name | lower }}/delete/", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}BulkDeleteView.as_view(), name="{{ cookiecutter.model_class_name.lower() }}_bulk_delete"), - path("{{ cookiecutter.model_class_name | lower }}/edit/", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}BulkEditView.as_view(), name="{{ cookiecutter.model_class_name.lower() }}_bulk_edit"), - path("{{ cookiecutter.model_class_name | lower }}//", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}View.as_view(), name="{{ cookiecutter.model_class_name.lower() }}"), - path("{{ cookiecutter.model_class_name | lower }}//delete/", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}DeleteView.as_view(), name="{{ cookiecutter.model_class_name.lower() }}_delete"), - path("{{ cookiecutter.model_class_name | lower }}//edit/", {{ cookiecutter.model_class_name.lower() }}.{{ cookiecutter.model_class_name }}EditView.as_view(), name="{{ cookiecutter.model_class_name.lower() }}_edit"), - path( - "{{ cookiecutter.model_class_name | lower }}//changelog/", - ObjectChangeLogView.as_view(), - name="{{ cookiecutter.model_class_name.lower() }}_changelog", - kwargs={"model": models.{{ cookiecutter.model_class_name }}}, - ), -] + +router = NautobotUIViewSetRouter() +router.register("{{ cookiecutter.model_class_name | lower }}", views.{{ cookiecutter.model_class_name}}UIViewSet) + +urlpatterns = router.urls diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py new file mode 100644 index 00000000..35537988 --- /dev/null +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py @@ -0,0 +1,18 @@ +"""Views for FloorPlan.""" +from nautobot.apps.viewsets import NautobotUIViewSet + +from {{ cookiecutter.plugin_name }} import filters, forms, models, tables +from {{ cookiecutter.plugin_name }}.api import serializers + + +class {{ cookiecutter.model_class_name}}UIViewSet(NautobotUIViewSet): + """ViewSet for {{ cookiecutter.model_class_name}} views.""" + + bulk_update_form_class = forms.{{ cookiecutter.model_class_name}}BulkEditForm + filterset_class = filters.{{ cookiecutter.model_class_name}}FilterSet + filterset_form_class = forms.{{ cookiecutter.model_class_name}}FilterForm + form_class = forms.{{ cookiecutter.model_class_name}}Form + lookup_field = "pk" + queryset = models.{{ cookiecutter.model_class_name}}.objects.all() + serializer_class = serializers.{{ cookiecutter.model_class_name}}Serializer + table_class = tables.{{ cookiecutter.model_class_name}}Table diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py deleted file mode 100644 index b990ba51..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py +++ /dev/null @@ -1,63 +0,0 @@ -"""Views for {{ cookiecutter.model_class_name }}.""" - -from nautobot.core.views import generic - -from {{ cookiecutter.plugin_name }} import filters, forms, models, tables - - -class {{ cookiecutter.model_class_name }}ListView(generic.ObjectListView): - """List view.""" - - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - # These aren't needed for simple models, but we can always add - # this search functionality. - filterset = filters.{{ cookiecutter.model_class_name }}FilterSet - filterset_form = forms.{{ cookiecutter.model_class_name }}FilterForm - table = tables.{{ cookiecutter.model_class_name }}Table - - # Option for modifying the top right buttons on the list view: - # action_buttons = ("add", "import", "export") - - -class {{ cookiecutter.model_class_name }}View(generic.ObjectView): - """Detail view.""" - - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - - -class {{ cookiecutter.model_class_name }}CreateView(generic.ObjectEditView): - """Create view.""" - - model = models.{{ cookiecutter.model_class_name }} - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - model_form = forms.{{ cookiecutter.model_class_name }}Form - - -class {{ cookiecutter.model_class_name }}DeleteView(generic.ObjectDeleteView): - """Delete view.""" - - model = models.{{ cookiecutter.model_class_name }} - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - - -class {{ cookiecutter.model_class_name }}EditView(generic.ObjectEditView): - """Edit view.""" - - model = models.{{ cookiecutter.model_class_name }} - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - model_form = forms.{{ cookiecutter.model_class_name }}Form - - -class {{ cookiecutter.model_class_name }}BulkDeleteView(generic.BulkDeleteView): - """View for deleting one or more {{ cookiecutter.model_class_name }} records.""" - - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - table = tables.{{ cookiecutter.model_class_name }}Table - - -class {{ cookiecutter.model_class_name }}BulkEditView(generic.BulkEditView): - """View for editing one or more {{ cookiecutter.model_class_name }} records.""" - - queryset = models.{{ cookiecutter.model_class_name }}.objects.all() - table = tables.{{ cookiecutter.model_class_name }}Table - form = forms.{{ cookiecutter.model_class_name }}BulkEditForm From ca45b57d460b6951779b9d00a3804b893cbb5773 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Wed, 8 Nov 2023 11:02:05 -0600 Subject: [PATCH 02/15] resolving issue with tests --- nautobot-app/hooks/post_gen_project.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nautobot-app/hooks/post_gen_project.py b/nautobot-app/hooks/post_gen_project.py index 62b0361d..0f90a9b9 100644 --- a/nautobot-app/hooks/post_gen_project.py +++ b/nautobot-app/hooks/post_gen_project.py @@ -25,7 +25,6 @@ if "{{ cookiecutter.model_class_name }}" == "None": files_to_remove = [ "api/__init__.py", - "api/nested_serializers.py", "api/serializers.py", "api/urls.py", "api/views.py", @@ -35,7 +34,7 @@ "models.py", "navigation.py", "tables.py", - "templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name.lower() }}.html", + "templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name.lower() }}_retrieve.html", "tests/fixtures.py", "tests/test_api_views.py", "tests/test_filter_{{ cookiecutter.model_class_name.lower() }}.py", @@ -43,7 +42,7 @@ "tests/test_model_{{ cookiecutter.model_class_name.lower() }}.py", "tests/test_views.py", "urls.py", - "views/{{ cookiecutter.model_class_name.lower() }}.py", + "views.py", ] for file in files_to_remove: (_ADDONS_PATH / file).unlink() @@ -52,13 +51,12 @@ "migrations", "templates/{{ cookiecutter.plugin_name }}", "templates", - "views", ] for folder in folders_to_remove: (_ADDONS_PATH / folder).rmdir() # Persist the baked cookie parameters in-repo for future usage as a replay file or for the drift management. - cookie = {{cookiecutter}} + cookie = {{ cookiecutter }} (_PROJECT_PATH / ".cookiecutter.json").write_text( json.dumps({"cookiecutter": cookie}, indent=4) + "\n", encoding="utf-8" ) From 69f0a264b79beb86e205d441826d8692585e2d22 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Wed, 8 Nov 2023 11:19:09 -0600 Subject: [PATCH 03/15] delete unneeded link --- .../{{cookiecutter.plugin_name}}/api/nested_serializers.py | 1 - 1 file changed, 1 deletion(-) delete mode 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py deleted file mode 120000 index 9d357efd..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py +++ /dev/null @@ -1 +0,0 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/nested_serializers.py \ No newline at end of file From 0ca63f4477b81578f93c74d59ef7a7e298cd5cf5 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Wed, 8 Nov 2023 11:23:31 -0600 Subject: [PATCH 04/15] link view file --- .../{{cookiecutter.plugin_name}}/views.py | 1 + .../views/{{ cookiecutter.model_class_name | lower }}.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py delete mode 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py new file mode 120000 index 00000000..64affc6c --- /dev/null +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py @@ -0,0 +1 @@ +nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py deleted file mode 120000 index 8c99e6be..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py +++ /dev/null @@ -1 +0,0 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views/{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file From 38ce723f637d4e6d1470184518d43321b42bf1ab Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Wed, 8 Nov 2023 11:30:11 -0600 Subject: [PATCH 05/15] fixing links --- ...kiecutter.model_class_name | lower }}.html | 1 - ....model_class_name | lower }}_retrieve.html | 26 +++++++++++++++++++ .../{{cookiecutter.plugin_name}}/views.py | 19 +++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) delete mode 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html create mode 100644 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html mode change 120000 => 100644 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html deleted file mode 120000 index 0fca0264..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html +++ /dev/null @@ -1 +0,0 @@ -../../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}.html \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html new file mode 100644 index 00000000..3af9df35 --- /dev/null +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html @@ -0,0 +1,26 @@ +{% raw %} +{% extends 'generic/object_retrieve.html' %} +{% load helpers %} + +{% block content_left_page %} +
+
+ {% endraw %}{{ cookiecutter.model_class_name }}{% raw %} +
+ + + + + + + + + +
Name + {{ object.name }} +
Description + {{ object.description|placeholder }} +
+
+{% endblock %} +{% endraw %} diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py deleted file mode 120000 index 64affc6c..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py +++ /dev/null @@ -1 +0,0 @@ -nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py new file mode 100644 index 00000000..35537988 --- /dev/null +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py @@ -0,0 +1,18 @@ +"""Views for FloorPlan.""" +from nautobot.apps.viewsets import NautobotUIViewSet + +from {{ cookiecutter.plugin_name }} import filters, forms, models, tables +from {{ cookiecutter.plugin_name }}.api import serializers + + +class {{ cookiecutter.model_class_name}}UIViewSet(NautobotUIViewSet): + """ViewSet for {{ cookiecutter.model_class_name}} views.""" + + bulk_update_form_class = forms.{{ cookiecutter.model_class_name}}BulkEditForm + filterset_class = filters.{{ cookiecutter.model_class_name}}FilterSet + filterset_form_class = forms.{{ cookiecutter.model_class_name}}FilterForm + form_class = forms.{{ cookiecutter.model_class_name}}Form + lookup_field = "pk" + queryset = models.{{ cookiecutter.model_class_name}}.objects.all() + serializer_class = serializers.{{ cookiecutter.model_class_name}}Serializer + table_class = tables.{{ cookiecutter.model_class_name}}Table From 22ea7ec6ed9e6e0e5ae9848c4e1837e9bd2a5348 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 12:52:10 -0600 Subject: [PATCH 06/15] updates for feedback --- ....model_class_name | lower }}_retrieve.html | 27 +------------------ .../{{cookiecutter.plugin_name}}/views.py | 19 +------------ nautobot-app/hooks/post_gen_project.py | 2 +- .../navigation.py | 2 +- ....model_class_name | lower }}_retrieve.html | 2 +- .../{{cookiecutter.plugin_name}}/views.py | 2 +- 6 files changed, 6 insertions(+), 48 deletions(-) mode change 100644 => 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html mode change 100644 => 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html deleted file mode 100644 index 3af9df35..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html +++ /dev/null @@ -1,26 +0,0 @@ -{% raw %} -{% extends 'generic/object_retrieve.html' %} -{% load helpers %} - -{% block content_left_page %} -
-
- {% endraw %}{{ cookiecutter.model_class_name }}{% raw %} -
- - - - - - - - - -
Name - {{ object.name }} -
Description - {{ object.description|placeholder }} -
-
-{% endblock %} -{% endraw %} diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html new file mode 120000 index 00000000..aef948cf --- /dev/null +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html @@ -0,0 +1 @@ +../../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py deleted file mode 100644 index 35537988..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Views for FloorPlan.""" -from nautobot.apps.viewsets import NautobotUIViewSet - -from {{ cookiecutter.plugin_name }} import filters, forms, models, tables -from {{ cookiecutter.plugin_name }}.api import serializers - - -class {{ cookiecutter.model_class_name}}UIViewSet(NautobotUIViewSet): - """ViewSet for {{ cookiecutter.model_class_name}} views.""" - - bulk_update_form_class = forms.{{ cookiecutter.model_class_name}}BulkEditForm - filterset_class = filters.{{ cookiecutter.model_class_name}}FilterSet - filterset_form_class = forms.{{ cookiecutter.model_class_name}}FilterForm - form_class = forms.{{ cookiecutter.model_class_name}}Form - lookup_field = "pk" - queryset = models.{{ cookiecutter.model_class_name}}.objects.all() - serializer_class = serializers.{{ cookiecutter.model_class_name}}Serializer - table_class = tables.{{ cookiecutter.model_class_name}}Table diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py new file mode 120000 index 00000000..a404b3e1 --- /dev/null +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py @@ -0,0 +1 @@ +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py \ No newline at end of file diff --git a/nautobot-app/hooks/post_gen_project.py b/nautobot-app/hooks/post_gen_project.py index 0f90a9b9..11be373f 100644 --- a/nautobot-app/hooks/post_gen_project.py +++ b/nautobot-app/hooks/post_gen_project.py @@ -56,7 +56,7 @@ (_ADDONS_PATH / folder).rmdir() # Persist the baked cookie parameters in-repo for future usage as a replay file or for the drift management. - cookie = {{ cookiecutter }} + cookie = {{cookiecutter}} (_PROJECT_PATH / ".cookiecutter.json").write_text( json.dumps({"cookiecutter": cookie}, indent=4) + "\n", encoding="utf-8" ) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py index 79dda102..7adaa7c6 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py @@ -1,7 +1,7 @@ """Menu items.""" from nautobot.apps.ui import NavMenuAddButton, NavMenuGroup, NavMenuItem, NavMenuTab -from nautobot.utilities.choices import ButtonColorChoices + items = ( NavMenuItem( diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html index 3af9df35..66cc5ad0 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html @@ -11,7 +11,7 @@ Name - {{ object.name }} + {{ object.name }} diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py index 35537988..9a67b290 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py @@ -1,4 +1,4 @@ -"""Views for FloorPlan.""" +"""Views for {{ cookiecutter.plugin_name }}.""" from nautobot.apps.viewsets import NautobotUIViewSet from {{ cookiecutter.plugin_name }} import filters, forms, models, tables From 9e5196e2a78bf35e9139b6565378849f05d9c9f4 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 14:12:57 -0600 Subject: [PATCH 07/15] feedback and local testing updates --- nautobot-app/hooks/post_gen_project.py | 1 + .../development/docker-compose.dev.yml | 8 ++++++++ .../{{cookiecutter.plugin_name}}/api/serializers.py | 2 +- .../{{cookiecutter.plugin_name}}/filters.py | 4 ++-- .../{{cookiecutter.plugin_name}}/forms.py | 4 ++-- .../{{cookiecutter.plugin_name}}/models.py | 3 ++- .../{{cookiecutter.plugin_name}}/navigation.py | 2 +- .../{{cookiecutter.plugin_name}}/tables.py | 2 +- ..._filter_{{ cookiecutter.model_class_name | lower }}.py | 5 ----- ...st_form_{{ cookiecutter.model_class_name | lower }}.py | 7 +------ ...t_model_{{ cookiecutter.model_class_name | lower }}.py | 4 +--- .../{{cookiecutter.plugin_name}}/tests/test_views.py | 6 ++++++ .../{{cookiecutter.plugin_name}}/views.py | 2 +- 13 files changed, 27 insertions(+), 23 deletions(-) diff --git a/nautobot-app/hooks/post_gen_project.py b/nautobot-app/hooks/post_gen_project.py index 11be373f..009b75a3 100644 --- a/nautobot-app/hooks/post_gen_project.py +++ b/nautobot-app/hooks/post_gen_project.py @@ -14,6 +14,7 @@ * cp development/creds.example.env development/creds.env * poetry shell * invoke makemigrations +* black . # this will ensure all python files are formatted correctly, may require `sudo chown -R ./` as migrations may be owned by root The file `creds.env` will be ignored by git and can be used to override default environment variables. """ diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.dev.yml b/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.dev.yml index 7a0593f4..86366357 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.dev.yml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/development/docker-compose.dev.yml @@ -38,6 +38,14 @@ services: - "../:/source" healthcheck: test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test + beat: + entrypoint: + - "sh" + - "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env + - "watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery beat -l $$NAUTOBOT_LOG_LEVEL" ## $$ because of docker-compose + volumes: + - "./nautobot_config.py:/opt/nautobot/nautobot_config.py" + - "../:/source" # To expose postgres or redis to the host uncomment the following # postgres: # ports: diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py index b11a267d..b3585cce 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py @@ -4,7 +4,7 @@ from {{ cookiecutter.plugin_name }} import models -class {{ cookiecutter.model_class_name }}Serializer(NautobotModelSerializer, TaggedModelSerializerMixin): +class {{ cookiecutter.model_class_name }}Serializer(NautobotModelSerializer, TaggedModelSerializerMixin): # pylint: disable=too-many-ancestors """{{ cookiecutter.model_class_name }} Serializer.""" class Meta: diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py index a50b6e03..1445143f 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py @@ -1,11 +1,11 @@ """Filtering for {{ cookiecutter.plugin_name }}.""" -from nautobot.apps.filters import NautobotFilterSet +from nautobot.apps.filters import NautobotFilterSet, NameSearchFilterSet from {{ cookiecutter.plugin_name }} import models -class {{ cookiecutter.model_class_name }}FilterSet(NautobotFilterSet): +class {{ cookiecutter.model_class_name }}FilterSet(NautobotFilterSet, NameSearchFilterSet): # pylint: disable=too-many-ancestors """Filter for {{ cookiecutter.model_class_name }}.""" class Meta: diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py index af6ca1da..f74cb470 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py @@ -5,7 +5,7 @@ from {{ cookiecutter.plugin_name }} import models -class {{ cookiecutter.model_class_name }}Form(NautobotModelForm): +class {{ cookiecutter.model_class_name }}Form(NautobotModelForm): # pylint: disable=too-many-ancestors """{{ cookiecutter.model_class_name }} creation/edit form.""" class Meta: @@ -18,7 +18,7 @@ class Meta: ] -class {{ cookiecutter.model_class_name }}BulkEditForm(TagsBulkEditFormMixin, NautobotBulkEditForm): +class {{ cookiecutter.model_class_name }}BulkEditForm(TagsBulkEditFormMixin, NautobotBulkEditForm): # pylint: disable=too-many-ancestors """{{ cookiecutter.model_class_name }} bulk edit form.""" pk = forms.ModelMultipleChoiceField(queryset=models.{{ cookiecutter.model_class_name }}.objects.all(), widget=forms.MultipleHiddenInput) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py index 00c2c6ed..d8798660 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py @@ -13,9 +13,10 @@ # Then based on your reading you may decide to put the following decorator before the declaration of your class # @extras_features("custom_fields", "custom_validators", "relationships", "graphql") + # If you want to choose a specific model to overload in your class declaration, please reference the following documentation: # how to chose a database model: https://docs.nautobot.com/projects/core/en/stable/plugins/development/#database-models -class {{ cookiecutter.model_class_name }}(PrimaryModel): +class {{ cookiecutter.model_class_name }}(PrimaryModel): # pylint: disable=too-many-ancestors """Base model for {{ cookiecutter.verbose_name }} plugin.""" name = models.CharField(max_length=100, unique=True) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py index 7adaa7c6..fbd5caa3 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py @@ -6,7 +6,7 @@ items = ( NavMenuItem( link="plugins:{{ cookiecutter.plugin_name }}:{{ cookiecutter.model_class_name.lower() }}_list", - link_text="{{ cookiecutter.verbose_name }}", + name="{{ cookiecutter.verbose_name }}", permissions=["{{ cookiecutter.plugin_name }}.view_{{ cookiecutter.model_class_name.lower() }}"], buttons=( NavMenuAddButton( diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py index f9e6c8ea..f99cf0b0 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py @@ -17,7 +17,7 @@ class {{ cookiecutter.model_class_name }}Table(BaseTable): # Option for modifying the default action buttons on each row: # buttons=("changelog", "edit", "delete"), # Option for modifying the pk for the action buttons: - pk_field="slug", + pk_field="pk", ) class Meta(BaseTable.Meta): diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py index c53fa7dc..51ae405c 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py @@ -21,11 +21,6 @@ def test_q_search_name(self): params = {"q": "Test One"} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) - def test_q_search_slug(self): - """Test using Q search with slug of {{ cookiecutter.model_class_name }}.""" - params = {"q": "test-one"} - self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) - def test_q_invalid(self): """Test using invalid Q search for {{ cookiecutter.model_class_name }}.""" params = {"q": "test-five"} diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py index 714542fb..d1669d83 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py @@ -27,11 +27,6 @@ def test_specifying_only_required_success(self): self.assertTrue(form.save()) def test_validate_name_{{ cookiecutter.model_class_name.lower() }}_is_required(self): - form = forms.{{ cookiecutter.model_class_name }}Form(data={"slug": "development"}) + form = forms.{{ cookiecutter.model_class_name }}Form(data={"description": "Development Testing"}) self.assertFalse(form.is_valid()) self.assertIn("This field is required.", form.errors["name"]) - - def test_validate_slug_is_required(self): - form = forms.{{ cookiecutter.model_class_name }}Form(data={"name": "Development"}) - self.assertFalse(form.is_valid()) - self.assertIn("This field is required.", form.errors["slug"]) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py index f655ad61..37ba789a 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py @@ -17,8 +17,6 @@ def test_create_{{ cookiecutter.model_class_name.lower() }}_only_required(self): def test_create_{{ cookiecutter.model_class_name.lower() }}_all_fields_success(self): """Create {{ cookiecutter.model_class_name }} with all fields.""" - {{ cookiecutter.model_class_name.lower() }} = models.{{ cookiecutter.model_class_name }}.objects.create( - name="Development", description="Development Test" - ) + {{ cookiecutter.model_class_name.lower() }} = models.{{ cookiecutter.model_class_name }}.objects.create(name="Development", description="Development Test") self.assertEqual({{ cookiecutter.model_class_name.lower() }}.name, "Development") self.assertEqual({{ cookiecutter.model_class_name.lower() }}.description, "Development Test") diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py index bde80696..6c7252b2 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py @@ -15,6 +15,12 @@ class {{ cookiecutter.model_class_name }}ViewTest(ViewTestCases.PrimaryObjectVie "name": "Test 1", "description": "Initial model", } + csv_data = ( + "name", + "Test csv1", + "Test csv2", + "Test csv3", + ) @classmethod def setUpTestData(cls): diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py index 9a67b290..9700eedd 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py @@ -1,5 +1,5 @@ """Views for {{ cookiecutter.plugin_name }}.""" -from nautobot.apps.viewsets import NautobotUIViewSet +from nautobot.apps.views import NautobotUIViewSet from {{ cookiecutter.plugin_name }} import filters, forms, models, tables from {{ cookiecutter.plugin_name }}.api import serializers From 2f1542bdaf5e9ea615efde643d762f11fe5abea8 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 15:25:55 -0600 Subject: [PATCH 08/15] consisten use of leading and trailing whitespace in j2 syntax --- nautobot-app-ssot/README.md | 2 +- nautobot-app-ssot/cookiecutter.json | 24 +++++----- .../{{ cookiecutter.project_slug }}/README.md | 36 +++++++-------- .../development/nautobot_config.py | 4 +- .../docs/admin/install.md | 18 ++++---- ...> icon-{{ cookiecutter.plugin_slug }}.png} | 0 .../pyproject.toml | 18 ++++---- .../__init__.py | 0 .../api/__init__.py | 0 .../api/serializers.py | 0 .../api/urls.py | 0 .../api/views.py | 0 .../diffsync/adapters/__init__.py | 0 .../diffsync/adapters/nautobot.py | 0 ...{ cookiecutter.system_of_record_slug }}.py | 0 .../diffsync/models/__init__.py | 0 .../diffsync/models/base.py | 0 .../diffsync/models/nautobot.py | 0 ...{ cookiecutter.system_of_record_slug }}.py | 0 .../filters.py | 0 .../forms.py | 0 .../jobs.py | 0 .../migrations/__init__.py | 0 .../models.py | 0 .../navigation.py | 0 .../tables.py | 0 ...model_class_name | lower }}_retrieve.html} | 0 .../tests/__init__.py | 0 .../tests/fixtures.py | 0 .../tests/fixtures/get_devices.json | 0 .../tests/test_api.py | 0 .../tests/test_api_views.py | 0 .../tests/test_basic.py | 0 ...ookiecutter.model_class_name | lower }}.py | 0 ...ookiecutter.model_class_name | lower }}.py | 0 ...ookiecutter.model_class_name | lower }}.py | 0 .../tests/test_views.py | 0 ...cutter.system_of_record_slug }}_adapter.py | 0 .../urls.py | 0 .../utils/__init__.py | 0 .../utils/nautobot.py | 0 ...{ cookiecutter.system_of_record_slug }}.py | 0 .../views.py | 0 nautobot-app/README.md | 2 +- nautobot-app/cookiecutter.json | 16 +++---- nautobot-app/hooks/post_gen_project.py | 2 +- .../.github/ISSUE_TEMPLATE/bug_report.md | 6 +-- .../.github/ISSUE_TEMPLATE/feature_request.md | 4 +- .../.github/workflows/ci.yml | 32 ++++++------- .../.github/workflows/upstream_testing.yml | 4 +- .../{{ cookiecutter.project_slug }}/README.md | 36 +++++++-------- .../development/Dockerfile | 4 +- .../development/nautobot_config.py | 4 +- .../docs/admin/compatibility_matrix.md | 4 +- .../docs/admin/install.md | 18 ++++---- .../docs/admin/release_notes/version_1.0.md | 2 +- .../docs/admin/uninstall.md | 2 +- .../docs/admin/upgrade.md | 2 +- .../docs/dev/code_reference/api.md | 4 +- .../docs/dev/code_reference/package.md | 2 +- .../docs/dev/dev_environment.md | 6 +-- ...> icon-{{ cookiecutter.plugin_slug }}.png} | Bin .../invoke.example.yml | 6 +-- .../invoke.mysql.yml | 6 +-- .../mkdocs.yml | 10 ++--- .../pyproject.toml | 18 ++++---- .../{{ cookiecutter.project_slug }}/tasks.py | 42 +++++++++--------- .../__init__.py | 26 +++++++++++ .../api/__init__.py | 1 + .../api/serializers.py | 0 .../api/urls.py | 0 .../api/views.py | 2 +- .../filters.py | 0 .../forms.py | 0 .../migrations/__init__.py | 0 .../models.py | 0 .../navigation.py | 2 +- .../tables.py | 0 ...model_class_name | lower }}_retrieve.html} | 0 .../tests/__init__.py | 1 + .../tests/fixtures.py | 0 .../tests/test_api.py | 4 +- .../tests/test_api_views.py | 2 +- .../tests/test_basic.py | 0 ...ookiecutter.model_class_name | lower }}.py | 0 ...ookiecutter.model_class_name | lower }}.py | 0 ...ookiecutter.model_class_name | lower }}.py | 0 .../tests/test_views.py | 0 .../urls.py | 2 +- .../{{ cookiecutter.plugin_name }}/views.py | 18 ++++++++ .../{{cookiecutter.plugin_name}}/__init__.py | 26 ----------- .../api/__init__.py | 1 - .../tests/__init__.py | 1 - .../{{cookiecutter.plugin_name}}/views.py | 18 -------- 94 files changed, 219 insertions(+), 219 deletions(-) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/{icon-{{cookiecutter.plugin_slug}}.png => icon-{{ cookiecutter.plugin_slug }}.png} (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/serializers.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/urls.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/views.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/adapters/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/adapters/nautobot.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/adapters/{{ cookiecutter.system_of_record_slug }}.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/models/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/models/base.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/models/nautobot.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/diffsync/models/{{ cookiecutter.system_of_record_slug }}.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/filters.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/forms.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/jobs.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/migrations/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/models.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/navigation.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tables.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html => {{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html} (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/fixtures.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/fixtures/get_devices.json (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_api.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_api_views.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_basic.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_views.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/urls.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/utils/__init__.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/utils/nautobot.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/utils/{{ cookiecutter.system_of_record_slug }}.py (100%) rename nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/views.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/docs/images/{icon-{{cookiecutter.plugin_slug}}.png => icon-{{ cookiecutter.plugin_slug }}.png} (100%) create mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py create mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/serializers.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/urls.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/api/views.py (92%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/filters.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/forms.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/migrations/__init__.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/models.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/navigation.py (89%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tables.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html => {{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html} (100%) create mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/fixtures.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_api.py (89%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_api_views.py (93%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_basic.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/tests/test_views.py (100%) rename nautobot-app/{{ cookiecutter.project_slug }}/{{{cookiecutter.plugin_name}} => {{ cookiecutter.plugin_name }}}/urls.py (85%) create mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py diff --git a/nautobot-app-ssot/README.md b/nautobot-app-ssot/README.md index 1f05225f..57d9f1ec 100644 --- a/nautobot-app-ssot/README.md +++ b/nautobot-app-ssot/README.md @@ -10,7 +10,7 @@ The term SSoT, or Single Source of Truth, refers to the intention of using Nauto ### IMPORTANT Cookie Notes -- The logo of the project is a placeholder (`docs/images/icon-{{cookiecutter.plugin_slug}}.png`) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background! +- The logo of the project is a placeholder (`docs/images/icon-{{ cookiecutter.plugin_slug }}.png`) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background! - Please resolve and remove **all** of the comments and blocks marked with `Developer Note - Remove Me!` prior to publishing the documentation. Catch'em all with `rgrep "Developer Note"`. - The documentation website will be built and hosted on `readthedocs.io` for open source projects and follows the standard Network to Code branding for all our open source projects. diff --git a/nautobot-app-ssot/cookiecutter.json b/nautobot-app-ssot/cookiecutter.json index 30edc8e2..9b97b4fa 100644 --- a/nautobot-app-ssot/cookiecutter.json +++ b/nautobot-app-ssot/cookiecutter.json @@ -4,23 +4,23 @@ "email": "info@networktocode.com", "github_org": "nautobot", "system_of_record": "System of Record", - "system_of_record_camel": "{{cookiecutter.system_of_record.title().replace(' ', '').replace('_', '').replace('-', '')}}", - "system_of_record_slug": "{{cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_')}}", - "plugin_name": "nautobot_ssot_{{cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_')}}", - "verbose_name": "{{cookiecutter.plugin_name.title().replace('_', ' ')}}", - "plugin_slug": "{{cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-')}}", - "project_slug": "nautobot-plugin-ssot-{{cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-')}}", - "repo_url": "https://github.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}", - "base_url": "ssot-{{cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-')}}", + "system_of_record_camel": "{{ cookiecutter.system_of_record.title().replace(' ', '').replace('_', '').replace('-', '') }}", + "system_of_record_slug": "{{ cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_') }}", + "plugin_name": "nautobot_ssot_{{ cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_') }}", + "verbose_name": "{{ cookiecutter.plugin_name.title().replace('_', ' ') }}", + "plugin_slug": "{{ cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-') }}", + "project_slug": "nautobot-plugin-ssot-{{ cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-') }}", + "repo_url": "https://github.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}", + "base_url": "ssot-{{ cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-') }}", "min_nautobot_version": "1.6.0", "max_nautobot_version": "1.9999", - "camel_name": "{{cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '')}}", - "project_short_description": "{{cookiecutter.verbose_name}}", + "camel_name": "{{ cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '') }}", + "project_short_description": "{{ cookiecutter.verbose_name }}", "model_class_name": "None", "open_source_license": [ "Apache-2.0", "Not open source" ], "docs_base_url": "https://docs.nautobot.com", - "docs_app_url": "{{cookiecutter.docs_base_url}}/projects/{{cookiecutter.plugin_slug}}/en/latest" -} + "docs_app_url": "{{ cookiecutter.docs_base_url }}/projects/{{ cookiecutter.plugin_slug }}/en/latest" +} \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/README.md b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/README.md index 7714ef76..aed494fc 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/README.md +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/README.md @@ -1,4 +1,4 @@ -# {{cookiecutter.verbose_name}} SSoT +# {{ cookiecutter.verbose_name }} SSoT A plugin for [Nautobot](https://github.com/nautobot/nautobot). @@ -9,18 +9,18 @@ Developer Note - Remove Me! The README will have certain links/images broken until the PR is merged into `develop`. Update the GitHub links with whichever branch you're using (main etc.) if different. -The logo of the project is a placeholder (docs/images/icon-{{cookiecutter.plugin_slug}}.png) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background! +The logo of the project is a placeholder (docs/images/icon-{{ cookiecutter.plugin_slug }}.png) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background! To avoid extra work and temporary links, make sure that publishing docs (or merging a PR) is done at the same time as setting up the docs site on RTD, then test everything. -->

- +
- - - - + + + +
An App for Nautobot.

@@ -35,9 +35,9 @@ To avoid extra work and temporary links, make sure that publishing docs (or merg > Developer Note: Place the files in the `docs/images/` folder and link them using only full URLs from GitHub, for example: `![Overview](https://raw.githubusercontent.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/develop/docs/images/plugin-overview.png)`. This absolute static linking is required to ensure the README renders properly in GitHub, the docs site, and any other external sites like PyPI. -More screenshots can be found in the [Using the App]({{cookiecutter.docs_app_url}}/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality: +More screenshots can be found in the [Using the App]({{ cookiecutter.docs_app_url }}/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality: -![](https://raw.githubusercontent.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}/develop/docs/images/placeholder.png) +![](https://raw.githubusercontent.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/develop/docs/images/placeholder.png) ## Try it out! @@ -49,22 +49,22 @@ This App is installed in the Nautobot Community Sandbox found over at [demo.naut ## Documentation -Full documentation for this App can be found over on the [Nautobot Docs]({{cookiecutter.docs_base_url}}) website: +Full documentation for this App can be found over on the [Nautobot Docs]({{ cookiecutter.docs_base_url }}) website: -- [User Guide]({{cookiecutter.docs_app_url}}/user/app_overview/) - Overview, Using the App, Getting Started. -- [Administrator Guide]({{cookiecutter.docs_app_url}}/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App. -- [Developer Guide]({{cookiecutter.docs_app_url}}/dev/contributing/) - Extending the App, Code Reference, Contribution Guide. -- [Release Notes / Changelog]({{cookiecutter.docs_app_url}}/admin/release_notes/). -- [Frequently Asked Questions]({{cookiecutter.docs_app_url}}/user/faq/). +- [User Guide]({{ cookiecutter.docs_app_url }}/user/app_overview/) - Overview, Using the App, Getting Started. +- [Administrator Guide]({{ cookiecutter.docs_app_url }}/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App. +- [Developer Guide]({{ cookiecutter.docs_app_url }}/dev/contributing/) - Extending the App, Code Reference, Contribution Guide. +- [Release Notes / Changelog]({{ cookiecutter.docs_app_url }}/admin/release_notes/). +- [Frequently Asked Questions]({{ cookiecutter.docs_app_url }}/user/faq/). ### Contributing to the Documentation -You can find all the Markdown source for the App documentation under the [`docs`]({{cookiecutter.repo_url}}/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient: clone the repository and edit away. +You can find all the Markdown source for the App documentation under the [`docs`]({{ cookiecutter.repo_url }}/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient: clone the repository and edit away. -If you need to view the fully-generated documentation site, you can build it with [MkDocs](https://www.mkdocs.org/). A container hosting the documentation can be started using the `invoke` commands (details in the [Development Environment Guide]({{cookiecutter.docs_app_url}}/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). Using this container, as your changes to the documentation are saved, they will be automatically rebuilt and any pages currently being viewed will be reloaded in your browser. +If you need to view the fully-generated documentation site, you can build it with [MkDocs](https://www.mkdocs.org/). A container hosting the documentation can be started using the `invoke` commands (details in the [Development Environment Guide]({{ cookiecutter.docs_app_url }}/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). Using this container, as your changes to the documentation are saved, they will be automatically rebuilt and any pages currently being viewed will be reloaded in your browser. Any PRs with fixes or improvements are very welcome! ## Questions -For any questions or comments, please check the [FAQ]({{cookiecutter.docs_app_url}}/user/faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`), sign up [here](http://slack.networktocode.com/) if you don't have an account. +For any questions or comments, please check the [FAQ]({{ cookiecutter.docs_app_url }}/user/faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`), sign up [here](http://slack.networktocode.com/) if you don't have an account. diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/development/nautobot_config.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/development/nautobot_config.py index 4b6826c0..15711d37 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/development/nautobot_config.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/development/nautobot_config.py @@ -131,7 +131,7 @@ # Enable installed Apps. Add the name of each App to the list. PLUGINS = [ "nautobot_ssot", - "{{cookiecutter.plugin_name}}", + "{{ cookiecutter.plugin_name }}", ] # Apps configuration settings. These settings are used by various Apps that the user may have installed. @@ -140,7 +140,7 @@ "nautobot_ssot": { "hide_example_jobs": True, }, - # '{{cookiecutter.plugin_name}}': { + # '{{ cookiecutter.plugin_name }}': { # 'foo': 'bar', # 'buzz': 'bazz', # }, diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/admin/install.md b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/admin/install.md index 0c730184..b3c59c05 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/admin/install.md +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/admin/install.md @@ -7,7 +7,7 @@ Here you will find detailed instructions on how to **install** and **configure** ## Prerequisites -- The plugin is compatible with Nautobot {{cookiecutter.min_nautobot_version}} and higher. +- The plugin is compatible with Nautobot {{ cookiecutter.min_nautobot_version }} and higher. - Databases supported: PostgreSQL, MySQL !!! note @@ -21,37 +21,37 @@ Here you will find detailed instructions on how to **install** and **configure** ## Install Guide !!! note - Plugins can be installed manually or using Python's `pip`. See the [nautobot documentation](https://nautobot.readthedocs.io/en/latest/plugins/#install-the-package) for more details. The pip package name for this plugin is [`{{cookiecutter.plugin_slug}}`](https://pypi.org/project/{{cookiecutter.plugin_slug}}/). + Plugins can be installed manually or using Python's `pip`. See the [nautobot documentation](https://nautobot.readthedocs.io/en/latest/plugins/#install-the-package) for more details. The pip package name for this plugin is [`{{ cookiecutter.plugin_slug }}`](https://pypi.org/project/{{ cookiecutter.plugin_slug }}/). The plugin is available as a Python package via PyPI and can be installed with `pip`: ```shell -pip install {{cookiecutter.plugin_slug}} +pip install {{ cookiecutter.plugin_slug }} ``` -To ensure {{cookiecutter.verbose_name}} is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the Nautobot root directory (alongside `requirements.txt`) and list the `{{cookiecutter.plugin_slug}}` package: +To ensure {{ cookiecutter.verbose_name }} is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the Nautobot root directory (alongside `requirements.txt`) and list the `{{ cookiecutter.plugin_slug }}` package: ```shell -echo {{cookiecutter.plugin_slug}} >> local_requirements.txt +echo {{ cookiecutter.plugin_slug }} >> local_requirements.txt ``` Once installed, the plugin needs to be enabled in your Nautobot configuration. The following block of code below shows the additional configuration required to be added to your `nautobot_config.py` file: -- Append `"{{cookiecutter.plugin_name}}"` to the `PLUGINS` list. -- Append the `"{{cookiecutter.plugin_name}}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults. +- Append `"{{ cookiecutter.plugin_name }}"` to the `PLUGINS` list. +- Append the `"{{ cookiecutter.plugin_name }}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults. ```python # In your nautobot_config.py PLUGINS = [ "nautobot_ssot", - "{{cookiecutter.plugin_name}}", + "{{ cookiecutter.plugin_name }}", ] PLUGINS_CONFIG = { "nautobot_ssot": { "hide_example_jobs": True, }, - '{{cookiecutter.plugin_name}}': { + '{{ cookiecutter.plugin_name }}': { # ADD YOUR SETTINGS HERE }, } diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{cookiecutter.plugin_slug}}.png b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{cookiecutter.plugin_slug}}.png rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml index 5aadf32c..c3fdbf4c 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml @@ -1,14 +1,14 @@ [tool.poetry] -name = "{{cookiecutter.plugin_slug}}" +name = "{{ cookiecutter.plugin_slug }}" version = "0.1.0" -description = "{{cookiecutter.project_short_description}}" -authors = ["{{cookiecutter.full_name}} <{{cookiecutter.email}}>"] +description = "{{ cookiecutter.project_short_description }}" +authors = ["{{ cookiecutter.full_name }} <{{ cookiecutter.email }}>"] {%- if cookiecutter.open_source_license == 'Apache-2.0' %} -license = "{{cookiecutter.open_source_license}}" +license = "{{ cookiecutter.open_source_license }}" {%- endif %} readme = "README.md" -homepage = "{{cookiecutter.repo_url}}" -repository = "{{cookiecutter.repo_url}}" +homepage = "{{ cookiecutter.repo_url }}" +repository = "{{ cookiecutter.repo_url }}" keywords = ["nautobot", "nautobot-plugin"] classifiers = [ "Intended Audience :: Developers", @@ -26,13 +26,13 @@ include = [ "README.md", ] packages = [ - { include = "{{cookiecutter.plugin_name}}" }, + { include = "{{ cookiecutter.plugin_name }}" }, ] [tool.poetry.dependencies] python = ">=3.8,<3.12" # Used for local development -nautobot = "^{{cookiecutter.min_nautobot_version}}" +nautobot = "^{{ cookiecutter.min_nautobot_version }}" nautobot-ssot = "^1.1.0" [tool.poetry.group.dev.dependencies] @@ -108,7 +108,7 @@ notes = """, [tool.pylint-nautobot] supported_nautobot_versions = [ - "{{cookiecutter.min_nautobot_version}}" + "{{ cookiecutter.min_nautobot_version }}" ] [tool.pydocstyle] diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/adapters/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/adapters/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/adapters/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/adapters/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/adapters/nautobot.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/adapters/nautobot.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/adapters/nautobot.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/adapters/nautobot.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/adapters/{{ cookiecutter.system_of_record_slug }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/adapters/{{ cookiecutter.system_of_record_slug }}.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/adapters/{{ cookiecutter.system_of_record_slug }}.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/adapters/{{ cookiecutter.system_of_record_slug }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/base.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/base.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/base.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/base.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/nautobot.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/nautobot.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/nautobot.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/nautobot.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/{{ cookiecutter.system_of_record_slug }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/{{ cookiecutter.system_of_record_slug }}.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/diffsync/models/{{ cookiecutter.system_of_record_slug }}.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/{{ cookiecutter.system_of_record_slug }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/jobs.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/jobs.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/jobs.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/jobs.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/migrations/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/migrations/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures/get_devices.json b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures/get_devices.json similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures/get_devices.json rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures/get_devices.json diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_basic.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_basic.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/utils/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/utils/__init__.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/utils/__init__.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/utils/__init__.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/utils/nautobot.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/utils/nautobot.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/utils/nautobot.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/utils/nautobot.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/utils/{{ cookiecutter.system_of_record_slug }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/utils/{{ cookiecutter.system_of_record_slug }}.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/utils/{{ cookiecutter.system_of_record_slug }}.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/utils/{{ cookiecutter.system_of_record_slug }}.py diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py similarity index 100% rename from nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py rename to nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py diff --git a/nautobot-app/README.md b/nautobot-app/README.md index 8d229352..fd9df0e9 100644 --- a/nautobot-app/README.md +++ b/nautobot-app/README.md @@ -8,7 +8,7 @@ This folder provides a Cookiecutter template for a Nautobot App that adheres to ### IMPORTANT Cookie Notes -- The logo of the project is a placeholder (`docs/images/icon-{{cookiecutter.plugin_slug}}.png`) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background! +- The logo of the project is a placeholder (`docs/images/icon-{{ cookiecutter.plugin_slug }}.png`) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background! - Please resolve and remove **all** of the comments and blocks marked with `Developer Note - Remove Me!` prior to publishing the documentation. Catch'em all with `rgrep "Developer Note"`. - The documentation website will be built and hosted on `readthedocs.io` for open source projects and follows the standard Network to Code branding for all our open source projects. diff --git a/nautobot-app/cookiecutter.json b/nautobot-app/cookiecutter.json index 1098f9b9..1ed231ca 100644 --- a/nautobot-app/cookiecutter.json +++ b/nautobot-app/cookiecutter.json @@ -4,20 +4,20 @@ "email": "info@networktocode.com", "github_org": "nautobot", "plugin_name": "my_plugin", - "verbose_name": "{{cookiecutter.plugin_name.title().replace('_', ' ')}}", - "plugin_slug": "{{cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-')}}", - "project_slug": "nautobot-plugin-{{cookiecutter.plugin_slug}}", - "repo_url": "https://github.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}", - "base_url": "{{cookiecutter.plugin_slug}}", + "verbose_name": "{{ cookiecutter.plugin_name.title().replace('_', ' ') }}", + "plugin_slug": "{{ cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-') }}", + "project_slug": "nautobot-plugin-{{ cookiecutter.plugin_slug }}", + "repo_url": "https://github.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}", + "base_url": "{{ cookiecutter.plugin_slug }}", "min_nautobot_version": "2.0.0", "max_nautobot_version": "2.9999", - "camel_name": "{{cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '')}}", - "project_short_description": "{{cookiecutter.verbose_name}}", + "camel_name": "{{ cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '') }}", + "project_short_description": "{{ cookiecutter.verbose_name }}", "model_class_name": "None", "open_source_license": [ "Apache-2.0", "Not open source" ], "docs_base_url": "https://docs.nautobot.com", - "docs_app_url": "{{cookiecutter.docs_base_url}}/projects/{{cookiecutter.plugin_slug}}/en/latest" + "docs_app_url": "{{ cookiecutter.docs_base_url }}/projects/{{ cookiecutter.plugin_slug }}/en/latest" } \ No newline at end of file diff --git a/nautobot-app/hooks/post_gen_project.py b/nautobot-app/hooks/post_gen_project.py index 009b75a3..d90caff1 100644 --- a/nautobot-app/hooks/post_gen_project.py +++ b/nautobot-app/hooks/post_gen_project.py @@ -57,7 +57,7 @@ (_ADDONS_PATH / folder).rmdir() # Persist the baked cookie parameters in-repo for future usage as a replay file or for the drift management. - cookie = {{cookiecutter}} + cookie = {{ cookiecutter }} (_PROJECT_PATH / ".cookiecutter.json").write_text( json.dumps({"cookiecutter": cookie}, indent=4) + "\n", encoding="utf-8" ) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/bug_report.md b/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/bug_report.md index b6b22d62..acca3ff4 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/bug_report.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,12 +1,12 @@ --- name: 🐛 Bug Report -about: Report a reproducible bug in the current release of {{cookiecutter.plugin_slug}} +about: Report a reproducible bug in the current release of {{ cookiecutter.plugin_slug }} --- ### Environment * Python version: -* Nautobot version: -* {{cookiecutter.plugin_slug}} version: +* Nautobot version: +* {{ cookiecutter.plugin_slug }} version: ### Expected Behavior diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/feature_request.md b/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/feature_request.md index 6034a008..4c6af8fa 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/feature_request.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/.github/ISSUE_TEMPLATE/feature_request.md @@ -5,8 +5,8 @@ about: Propose a new feature or enhancement --- ### Environment -* Nautobot version: -* {{cookiecutter.plugin_slug}} version: +* Nautobot version: +* {{ cookiecutter.plugin_slug }} version:

- +
- - - - + + + +
An App for Nautobot.

@@ -31,9 +31,9 @@ To avoid extra work and temporary links, make sure that publishing docs (or merg > Developer Note: Place the files in the `docs/images/` folder and link them using only full URLs from GitHub, for example: `![Overview](https://raw.githubusercontent.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/develop/docs/images/plugin-overview.png)`. This absolute static linking is required to ensure the README renders properly in GitHub, the docs site, and any other external sites like PyPI. -More screenshots can be found in the [Using the App]({{cookiecutter.docs_app_url}}/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality: +More screenshots can be found in the [Using the App]({{ cookiecutter.docs_app_url }}/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality: -![](https://raw.githubusercontent.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}/develop/docs/images/placeholder.png) +![](https://raw.githubusercontent.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/develop/docs/images/placeholder.png) ## Try it out! @@ -45,22 +45,22 @@ This App is installed in the Nautobot Community Sandbox found over at [demo.naut ## Documentation -Full documentation for this App can be found over on the [Nautobot Docs]({{cookiecutter.docs_base_url}}) website: +Full documentation for this App can be found over on the [Nautobot Docs]({{ cookiecutter.docs_base_url }}) website: -- [User Guide]({{cookiecutter.docs_app_url}}/user/app_overview/) - Overview, Using the App, Getting Started. -- [Administrator Guide]({{cookiecutter.docs_app_url}}/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App. -- [Developer Guide]({{cookiecutter.docs_app_url}}/dev/contributing/) - Extending the App, Code Reference, Contribution Guide. -- [Release Notes / Changelog]({{cookiecutter.docs_app_url}}/admin/release_notes/). -- [Frequently Asked Questions]({{cookiecutter.docs_app_url}}/user/faq/). +- [User Guide]({{ cookiecutter.docs_app_url }}/user/app_overview/) - Overview, Using the App, Getting Started. +- [Administrator Guide]({{ cookiecutter.docs_app_url }}/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App. +- [Developer Guide]({{ cookiecutter.docs_app_url }}/dev/contributing/) - Extending the App, Code Reference, Contribution Guide. +- [Release Notes / Changelog]({{ cookiecutter.docs_app_url }}/admin/release_notes/). +- [Frequently Asked Questions]({{ cookiecutter.docs_app_url }}/user/faq/). ### Contributing to the Documentation -You can find all the Markdown source for the App documentation under the [`docs`]({{cookiecutter.repo_url}}/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient: clone the repository and edit away. +You can find all the Markdown source for the App documentation under the [`docs`]({{ cookiecutter.repo_url }}/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient: clone the repository and edit away. -If you need to view the fully-generated documentation site, you can build it with [MkDocs](https://www.mkdocs.org/). A container hosting the documentation can be started using the `invoke` commands (details in the [Development Environment Guide]({{cookiecutter.docs_app_url}}/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). Using this container, as your changes to the documentation are saved, they will be automatically rebuilt and any pages currently being viewed will be reloaded in your browser. +If you need to view the fully-generated documentation site, you can build it with [MkDocs](https://www.mkdocs.org/). A container hosting the documentation can be started using the `invoke` commands (details in the [Development Environment Guide]({{ cookiecutter.docs_app_url }}/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). Using this container, as your changes to the documentation are saved, they will be automatically rebuilt and any pages currently being viewed will be reloaded in your browser. Any PRs with fixes or improvements are very welcome! ## Questions -For any questions or comments, please check the [FAQ]({{cookiecutter.docs_app_url}}/user/faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`), sign up [here](http://slack.networktocode.com/) if you don't have an account. +For any questions or comments, please check the [FAQ]({{ cookiecutter.docs_app_url }}/user/faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`), sign up [here](http://slack.networktocode.com/) if you don't have an account. diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/development/Dockerfile b/nautobot-app/{{ cookiecutter.project_slug }}/development/Dockerfile index 558e66a0..1c4400cc 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/development/Dockerfile +++ b/nautobot-app/{{ cookiecutter.project_slug }}/development/Dockerfile @@ -6,8 +6,8 @@ # ------------------------------------------------------------------------------------- # !!! USE CAUTION WHEN MODIFYING LINES BELOW -# Accepts a desired Nautobot version as build argument, default to {{cookiecutter.min_nautobot_version}} -ARG NAUTOBOT_VER="{{cookiecutter.min_nautobot_version}}" +# Accepts a desired Nautobot version as build argument, default to {{ cookiecutter.min_nautobot_version }} +ARG NAUTOBOT_VER="{{ cookiecutter.min_nautobot_version }}" # Accepts a desired Python version as build argument, default to 3.11 ARG PYTHON_VER="3.11" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/development/nautobot_config.py b/nautobot-app/{{ cookiecutter.project_slug }}/development/nautobot_config.py index 576359ea..19f8f2a4 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/development/nautobot_config.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/development/nautobot_config.py @@ -126,12 +126,12 @@ # # Enable installed Apps. Add the name of each App to the list. -PLUGINS = ["{{cookiecutter.plugin_name}}"] +PLUGINS = ["{{ cookiecutter.plugin_name }}"] # Apps configuration settings. These settings are used by various Apps that the user may have installed. # Each key in the dictionary is the name of an installed App and its value is a dictionary of settings. # PLUGINS_CONFIG = { -# '{{cookiecutter.plugin_name}}': { +# '{{ cookiecutter.plugin_name }}': { # 'foo': 'bar', # 'buzz': 'bazz' # } diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md index 76aabdba..1830d4ac 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md @@ -3,6 +3,6 @@ !!! warning "Developer Note - Remove Me!" Explain how the release models of the plugin and of Nautobot work together, how releases are supported, how features and older releases are deprecated etc. -| {{cookiecutter.verbose_name}} Version | Nautobot First Support Version | Nautobot Last Support Version | +| {{ cookiecutter.verbose_name }} Version | Nautobot First Support Version | Nautobot Last Support Version | | ------------- | -------------------- | ------------- | -| 1.0.X | {{cookiecutter.min_nautobot_version}} | 1.99.99 | +| 1.0.X | {{ cookiecutter.min_nautobot_version }} | 1.99.99 | diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md index 409f77fd..c1a11fb7 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md @@ -7,7 +7,7 @@ Here you will find detailed instructions on how to **install** and **configure** ## Prerequisites -- The plugin is compatible with Nautobot {{cookiecutter.min_nautobot_version}} and higher. +- The plugin is compatible with Nautobot {{ cookiecutter.min_nautobot_version }} and higher. - Databases supported: PostgreSQL, MySQL !!! note @@ -21,31 +21,31 @@ Here you will find detailed instructions on how to **install** and **configure** ## Install Guide !!! note - Plugins can be installed manually or using Python's `pip`. See the [nautobot documentation](https://nautobot.readthedocs.io/en/latest/plugins/#install-the-package) for more details. The pip package name for this plugin is [`{{cookiecutter.plugin_slug}}`](https://pypi.org/project/{{cookiecutter.plugin_slug}}/). + Plugins can be installed manually or using Python's `pip`. See the [nautobot documentation](https://nautobot.readthedocs.io/en/latest/plugins/#install-the-package) for more details. The pip package name for this plugin is [`{{ cookiecutter.plugin_slug }}`](https://pypi.org/project/{{ cookiecutter.plugin_slug }}/). The plugin is available as a Python package via PyPI and can be installed with `pip`: ```shell -pip install {{cookiecutter.plugin_slug}} +pip install {{ cookiecutter.plugin_slug }} ``` -To ensure {{cookiecutter.verbose_name}} is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the Nautobot root directory (alongside `requirements.txt`) and list the `{{cookiecutter.plugin_slug}}` package: +To ensure {{ cookiecutter.verbose_name }} is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the Nautobot root directory (alongside `requirements.txt`) and list the `{{ cookiecutter.plugin_slug }}` package: ```shell -echo {{cookiecutter.plugin_slug}} >> local_requirements.txt +echo {{ cookiecutter.plugin_slug }} >> local_requirements.txt ``` Once installed, the plugin needs to be enabled in your Nautobot configuration. The following block of code below shows the additional configuration required to be added to your `nautobot_config.py` file: -- Append `"{{cookiecutter.plugin_name}}"` to the `PLUGINS` list. -- Append the `"{{cookiecutter.plugin_name}}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults. +- Append `"{{ cookiecutter.plugin_name }}"` to the `PLUGINS` list. +- Append the `"{{ cookiecutter.plugin_name }}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults. ```python # In your nautobot_config.py -PLUGINS = ["{{cookiecutter.plugin_name}}"] +PLUGINS = ["{{ cookiecutter.plugin_name }}"] # PLUGINS_CONFIG = { -# "{{cookiecutter.plugin_name}}": { +# "{{ cookiecutter.plugin_name }}": { # ADD YOUR SETTINGS HERE # } # } diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/release_notes/version_1.0.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/release_notes/version_1.0.md index 8abd5552..c181648b 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/release_notes/version_1.0.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/release_notes/version_1.0.md @@ -37,7 +37,7 @@ This document describes all new features and changes in the release `1.0`. The f ### Fixed -- [#123]({{cookiecutter.repo_url}}/issues/123) Fixed Tag filtering not working in job launch form +- [#123]({{ cookiecutter.repo_url }}/issues/123) Fixed Tag filtering not working in job launch form ## [v1.0.0] - 2021-08-03 diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/uninstall.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/uninstall.md index 20cec678..86eb421e 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/uninstall.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/uninstall.md @@ -7,7 +7,7 @@ Here you will find any steps necessary to cleanly remove the App from your Nauto Prior to removing the plugin from the `nautobot_config.py`, run the following command to roll back any migration specific to this plugin. ```shell -nautobot-server migrate {{cookiecutter.project_slug.replace('-', '_')}} zero +nautobot-server migrate {{ cookiecutter.project_slug.replace('-', '_') }} zero ``` !!! warning "Developer Note - Remove Me!" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/upgrade.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/upgrade.md index e7381aac..72a11b50 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/upgrade.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/upgrade.md @@ -7,4 +7,4 @@ Here you will find any steps necessary to upgrade the App in your Nautobot envir !!! warning "Developer Note - Remove Me!" Add more detailed steps on how the app is upgraded in an existing Nautobot setup and any version specifics (such as upgrading between major versions with breaking changes). -When a new release comes out it may be necessary to run a migration of the database to account for any changes in the data models used by this plugin. Execute the command `nautobot-server post-upgrade` within the runtime environment of your Nautobot installation after updating the `{{cookiecutter.plugin_slug}}` package via `pip`. +When a new release comes out it may be necessary to run a migration of the database to account for any changes in the data models used by this plugin. Execute the command `nautobot-server post-upgrade` within the runtime environment of your Nautobot installation after updating the `{{ cookiecutter.plugin_slug }}` package via `pip`. diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/api.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/api.md index 81d9eaae..cf546297 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/api.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/api.md @@ -1,5 +1,5 @@ -# {{cookiecutter.verbose_name}} API Package +# {{ cookiecutter.verbose_name }} API Package -::: {{cookiecutter.plugin_name}}.api +::: {{ cookiecutter.plugin_name }}.api options: show_submodules: True diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/package.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/package.md index bbee13e3..8c21bcdf 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/package.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/code_reference/package.md @@ -1 +1 @@ -::: {{cookiecutter.plugin_name}} +::: {{ cookiecutter.plugin_name }} diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md index 04bdc234..b48467d5 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md @@ -13,14 +13,14 @@ This is a quick reference guide if you're already familiar with the development The [Invoke](http://www.pyinvoke.org/) library is used to provide some helper commands based on the environment. There are a few configuration parameters which can be passed to Invoke to override the default configuration: -- `nautobot_ver`: the version of Nautobot to use as a base for any built docker containers (default: {{cookiecutter.min_nautobot_version}}) -- `project_name`: the default docker compose project name (default: `{{cookiecutter.plugin_slug}}`) +- `nautobot_ver`: the version of Nautobot to use as a base for any built docker containers (default: {{ cookiecutter.min_nautobot_version }}) +- `project_name`: the default docker compose project name (default: `{{ cookiecutter.plugin_slug }}`) - `python_ver`: the version of Python to use as a base for any built docker containers (default: 3.11) - `local`: a boolean flag indicating if invoke tasks should be run on the host or inside the docker containers (default: False, commands will be run in docker containers) - `compose_dir`: the full path to a directory containing the project compose files - `compose_files`: a list of compose files applied in order (see [Multiple Compose files](https://docs.docker.com/compose/extends/#multiple-compose-files) for more information) -Using **Invoke** these configuration options can be overridden using [several methods](https://docs.pyinvoke.org/en/stable/concepts/configuration.html). Perhaps the simplest is setting an environment variable `INVOKE_{{cookiecutter.plugin_name.upper()}}_VARIABLE_NAME` where `VARIABLE_NAME` is the variable you are trying to override. The only exception is `compose_files`, because it is a list it must be overridden in a YAML file. There is an example `invoke.yml` (`invoke.example.yml`) in this directory which can be used as a starting point. +Using **Invoke** these configuration options can be overridden using [several methods](https://docs.pyinvoke.org/en/stable/concepts/configuration.html). Perhaps the simplest is setting an environment variable `INVOKE_{{ cookiecutter.plugin_name.upper() }}_VARIABLE_NAME` where `VARIABLE_NAME` is the variable you are trying to override. The only exception is `compose_files`, because it is a list it must be overridden in a YAML file. There is an example `invoke.yml` (`invoke.example.yml`) in this directory which can be used as a starting point. ### Docker Development Environment diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/images/icon-{{cookiecutter.plugin_slug}}.png b/nautobot-app/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/docs/images/icon-{{cookiecutter.plugin_slug}}.png rename to nautobot-app/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/invoke.example.yml b/nautobot-app/{{ cookiecutter.project_slug }}/invoke.example.yml index 2ca5e5b9..d76d1632 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/invoke.example.yml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/invoke.example.yml @@ -1,7 +1,7 @@ --- -{{cookiecutter.plugin_name}}: - project_name: "{{cookiecutter.plugin_slug}}" - nautobot_ver: "{{cookiecutter.min_nautobot_version}}" +{{ cookiecutter.plugin_name }}: + project_name: "{{ cookiecutter.plugin_slug }}" + nautobot_ver: "{{ cookiecutter.min_nautobot_version }}" local: false python_ver: "3.11" compose_dir: "development" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/invoke.mysql.yml b/nautobot-app/{{ cookiecutter.project_slug }}/invoke.mysql.yml index 35e26101..e0e248ff 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/invoke.mysql.yml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/invoke.mysql.yml @@ -1,7 +1,7 @@ --- -{{cookiecutter.plugin_name}}: - project_name: "{{cookiecutter.plugin_slug}}" - nautobot_ver: "{{cookiecutter.min_nautobot_version}}" +{{ cookiecutter.plugin_name }}: + project_name: "{{ cookiecutter.plugin_slug }}" + nautobot_ver: "{{ cookiecutter.min_nautobot_version }}" local: false python_ver: "3.11" compose_dir: "development" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/mkdocs.yml b/nautobot-app/{{ cookiecutter.project_slug }}/mkdocs.yml index 9696cc77..e42aa68b 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/mkdocs.yml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/mkdocs.yml @@ -1,10 +1,10 @@ --- dev_addr: "127.0.0.1:8001" -edit_uri: "edit/main/{{cookiecutter.project_slug}}/docs" -site_dir: "{{cookiecutter.plugin_name}}/static/{{cookiecutter.plugin_name}}/docs" -site_name: "{{cookiecutter.verbose_name}} Documentation" -site_url: "{{cookiecutter.docs_app_url}}/" -repo_url: "{{cookiecutter.repo_url}}" +edit_uri: "edit/main/{{ cookiecutter.project_slug }}/docs" +site_dir: "{{ cookiecutter.plugin_name }}/static/{{ cookiecutter.plugin_name }}/docs" +site_name: "{{ cookiecutter.verbose_name }} Documentation" +site_url: "{{ cookiecutter.docs_app_url }}/" +repo_url: "{{ cookiecutter.repo_url }}" copyright: "Copyright © The Authors" theme: name: "material" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml b/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml index 6d60ee8f..d2006d10 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml @@ -1,14 +1,14 @@ [tool.poetry] -name = "{{cookiecutter.plugin_slug}}" +name = "{{ cookiecutter.plugin_slug }}" version = "0.1.0" -description = "{{cookiecutter.project_short_description}}" -authors = ["{{cookiecutter.full_name}} <{{cookiecutter.email}}>"] +description = "{{ cookiecutter.project_short_description }}" +authors = ["{{ cookiecutter.full_name }} <{{ cookiecutter.email }}>"] {%- if cookiecutter.open_source_license == 'Apache-2.0' %} -license = "{{cookiecutter.open_source_license}}" +license = "{{ cookiecutter.open_source_license }}" {%- endif %} readme = "README.md" -homepage = "{{cookiecutter.repo_url}}" -repository = "{{cookiecutter.repo_url}}" +homepage = "{{ cookiecutter.repo_url }}" +repository = "{{ cookiecutter.repo_url }}" keywords = ["nautobot", "nautobot-plugin"] classifiers = [ "Intended Audience :: Developers", @@ -26,13 +26,13 @@ include = [ "README.md", ] packages = [ - { include = "{{cookiecutter.plugin_name}}" }, + { include = "{{ cookiecutter.plugin_name }}" }, ] [tool.poetry.dependencies] python = ">=3.8,<3.12" # Used for local development -nautobot = "^{{cookiecutter.min_nautobot_version}}" +nautobot = "^{{ cookiecutter.min_nautobot_version }}" [tool.poetry.group.dev.dependencies] bandit = "*" @@ -107,7 +107,7 @@ notes = """, [tool.pylint-nautobot] supported_nautobot_versions = [ - "{{cookiecutter.min_nautobot_version}}" + "{{ cookiecutter.min_nautobot_version }}" ] [tool.pydocstyle] diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py b/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py index e23c9b8d..f903d7b1 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py @@ -41,13 +41,13 @@ def is_truthy(arg): # Use pyinvoke configuration for default values, see http://docs.pyinvoke.org/en/stable/concepts/configuration.html -# Variables may be overwritten in invoke.yml or by the environment variables INVOKE_{{cookiecutter.plugin_name.upper()}}_xxx -namespace = Collection("{{cookiecutter.plugin_name}}") +# Variables may be overwritten in invoke.yml or by the environment variables INVOKE_{{ cookiecutter.plugin_name.upper() }}_xxx +namespace = Collection("{{ cookiecutter.plugin_name }}") namespace.configure( { - "{{cookiecutter.plugin_name}}": { - "nautobot_ver": "{{cookiecutter.min_nautobot_version}}", - "project_name": "{{cookiecutter.plugin_slug}}", + "{{ cookiecutter.plugin_name }}": { + "nautobot_ver": "{{ cookiecutter.min_nautobot_version }}", + "project_name": "{{ cookiecutter.plugin_slug }}", "python_ver": "3.11", "local": False, "compose_dir": os.path.join(os.path.dirname(__file__), "development"), @@ -64,7 +64,7 @@ def is_truthy(arg): def _is_compose_included(context, name): - return f"docker-compose.{name}.yml" in context.{{cookiecutter.plugin_name}}.compose_files + return f"docker-compose.{name}.yml" in context.{{ cookiecutter.plugin_name }}.compose_files def task(function=None, *args, **kwargs): @@ -97,19 +97,19 @@ def docker_compose(context, command, **kwargs): build_env = { # Note: 'docker compose logs' will stop following after 60 seconds by default, # so we are overriding that by setting this environment variable. - "COMPOSE_HTTP_TIMEOUT": context.{{cookiecutter.plugin_name}}.compose_http_timeout, - "NAUTOBOT_VER": context.{{cookiecutter.plugin_name}}.nautobot_ver, - "PYTHON_VER": context.{{cookiecutter.plugin_name}}.python_ver, + "COMPOSE_HTTP_TIMEOUT": context.{{ cookiecutter.plugin_name }}.compose_http_timeout, + "NAUTOBOT_VER": context.{{ cookiecutter.plugin_name }}.nautobot_ver, + "PYTHON_VER": context.{{ cookiecutter.plugin_name }}.python_ver, **kwargs.pop("env", {}), } compose_command_tokens = [ "docker compose", - f"--project-name {context.{{cookiecutter.plugin_name}}.project_name}", - f'--project-directory "{context.{{cookiecutter.plugin_name}}.compose_dir}"', + f"--project-name {context.{{ cookiecutter.plugin_name }}.project_name}", + f'--project-directory "{context.{{ cookiecutter.plugin_name }}.compose_dir}"', ] - for compose_file in context.{{cookiecutter.plugin_name}}.compose_files: - compose_file_path = os.path.join(context.{{cookiecutter.plugin_name}}.compose_dir, compose_file) + for compose_file in context.{{ cookiecutter.plugin_name }}.compose_files: + compose_file_path = os.path.join(context.{{ cookiecutter.plugin_name }}.compose_dir, compose_file) compose_command_tokens.append(f' -f "{compose_file_path}"') compose_command_tokens.append(command) @@ -127,7 +127,7 @@ def docker_compose(context, command, **kwargs): def run_command(context, command, **kwargs): """Wrapper to run a command locally or inside the nautobot container.""" - if is_truthy(context.{{cookiecutter.plugin_name}}.local): + if is_truthy(context.{{ cookiecutter.plugin_name }}.local): context.run(command, **kwargs) else: # Check if nautobot is running, no need to start another nautobot container to run a command @@ -161,7 +161,7 @@ def build(context, force_rm=False, cache=True): if force_rm: command += " --force-rm" - print(f"Building Nautobot with Python {context.{{cookiecutter.plugin_name}}.python_ver}...") + print(f"Building Nautobot with Python {context.{{ cookiecutter.plugin_name }}.python_ver}...") docker_compose(context, command) @@ -314,7 +314,7 @@ def createsuperuser(context, user="admin"): ) def makemigrations(context, name=""): """Perform makemigrations operation in Django.""" - command = "nautobot-server makemigrations {{cookiecutter.plugin_name}}" + command = "nautobot-server makemigrations {{ cookiecutter.plugin_name }}" if name: command += f" --name {name}" @@ -516,7 +516,7 @@ def docs(context): """Build and serve docs locally for development.""" command = "mkdocs serve -v" - if is_truthy(context.{{cookiecutter.plugin_name}}.local): + if is_truthy(context.{{ cookiecutter.plugin_name }}.local): print(">>> Serving Documentation at http://localhost:8001") run_command(context, command) else: @@ -579,7 +579,7 @@ def hadolint(context): @task def pylint(context): """Run pylint code analysis.""" - command = 'pylint --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml {{cookiecutter.plugin_name}}' + command = 'pylint --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml {{ cookiecutter.plugin_name }}' run_command(context, command) @@ -630,7 +630,7 @@ def check_migrations(context): def unittest( context, keepdb=False, - label="{{cookiecutter.plugin_name}}", + label="{{ cookiecutter.plugin_name }}", failfast=False, buffer=True, pattern="", @@ -656,7 +656,7 @@ def unittest( @task def unittest_coverage(context): """Report on code test coverage as measured by 'invoke unittest'.""" - command = "coverage report --skip-covered --include '{{cookiecutter.plugin_name}}/*' --omit *migrations*" + command = "coverage report --skip-covered --include '{{ cookiecutter.plugin_name }}/*' --omit *migrations*" run_command(context, command) @@ -671,7 +671,7 @@ def unittest_coverage(context): def tests(context, failfast=False, keepdb=False, lint_only=False): """Run all tests for this plugin.""" # If we are not running locally, start the docker containers so we don't have to for each test - if not is_truthy(context.{{cookiecutter.plugin_name}}.local): + if not is_truthy(context.{{ cookiecutter.plugin_name }}.local): print("Starting Docker Containers...") start(context) # Sorted loosely from fastest to slowest diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py new file mode 100644 index 00000000..a41d96d1 --- /dev/null +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py @@ -0,0 +1,26 @@ +"""Plugin declaration for {{ cookiecutter.plugin_name }}.""" +# Metadata is inherited from Nautobot. If not including Nautobot in the environment, this should be added +from importlib import metadata + +__version__ = metadata.version(__name__) + +from nautobot.apps import NautobotAppConfig + + +class {{ cookiecutter.camel_name }}Config(NautobotAppConfig): + """Plugin configuration for the {{ cookiecutter.plugin_name }} plugin.""" + + name = "{{ cookiecutter.plugin_name }}" + verbose_name = "{{ cookiecutter.verbose_name }}" + version = __version__ + author = "{{ cookiecutter.full_name }}" + description = "{{ cookiecutter.project_short_description }}." + base_url = "{{ cookiecutter.base_url }}" + required_settings = [] + min_version = "{{ cookiecutter.min_nautobot_version }}" + max_version = "{{ cookiecutter.max_nautobot_version }}" + default_settings = {} + caching_config = {} + + +config = {{ cookiecutter.camel_name }}Config # pylint:disable=invalid-name diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py new file mode 100644 index 00000000..f3ae94ec --- /dev/null +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py @@ -0,0 +1 @@ +"""REST API module for {{ cookiecutter.plugin_name }} plugin.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py similarity index 92% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py index 168df2f6..846c45dc 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py @@ -2,7 +2,7 @@ from nautobot.apps.api import NautobotModelViewSet -from {{cookiecutter.plugin_name }} import filters, models +from {{ cookiecutter.plugin_name }} import filters, models from {{ cookiecutter.plugin_name }}.api import serializers diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/migrations/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/migrations/__init__.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py similarity index 89% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py index fbd5caa3..51291170 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py @@ -20,6 +20,6 @@ menu_items = ( NavMenuTab( name="Plugins", - groups=(NavMenuGroup(name="{{cookiecutter.verbose_name}}", items=tuple(items)),), + groups=(NavMenuGroup(name="{{ cookiecutter.verbose_name }}", items=tuple(items)),), ), ) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py new file mode 100644 index 00000000..24374daf --- /dev/null +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py @@ -0,0 +1 @@ +"""Unit tests for {{ cookiecutter.plugin_name }} plugin.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py similarity index 89% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py index 82510445..deb81593 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py @@ -1,4 +1,4 @@ -"""Unit tests for {{cookiecutter.plugin_name}}.""" +"""Unit tests for {{ cookiecutter.plugin_name }}.""" from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse @@ -11,7 +11,7 @@ class PlaceholderAPITest(TestCase): - """Test the {{cookiecutter.camel_name}} API.""" + """Test the {{ cookiecutter.camel_name }} API.""" def setUp(self): """Create a superuser and token for API calls.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py similarity index 93% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py index 4c7dbf6e..a6c0bfab 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py @@ -1,4 +1,4 @@ -"""Unit tests for {{cookiecutter.plugin_name}}.""" +"""Unit tests for {{ cookiecutter.plugin_name }}.""" from nautobot.apps.testing import APIViewTestCases from {{ cookiecutter.plugin_name }} import models diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_basic.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_basic.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py similarity index 100% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py similarity index 85% rename from nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py rename to nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py index 324c6e70..d6a26306 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py @@ -5,6 +5,6 @@ router = NautobotUIViewSetRouter() -router.register("{{ cookiecutter.model_class_name | lower }}", views.{{ cookiecutter.model_class_name}}UIViewSet) +router.register("{{ cookiecutter.model_class_name | lower }}", views.{{ cookiecutter.model_class_name }}UIViewSet) urlpatterns = router.urls diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py new file mode 100644 index 00000000..9ac7370a --- /dev/null +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py @@ -0,0 +1,18 @@ +"""Views for {{ cookiecutter.plugin_name }}.""" +from nautobot.apps.views import NautobotUIViewSet + +from {{ cookiecutter.plugin_name }} import filters, forms, models, tables +from {{ cookiecutter.plugin_name }}.api import serializers + + +class {{ cookiecutter.model_class_name }}UIViewSet(NautobotUIViewSet): + """ViewSet for {{ cookiecutter.model_class_name }} views.""" + + bulk_update_form_class = forms.{{ cookiecutter.model_class_name }}BulkEditForm + filterset_class = filters.{{ cookiecutter.model_class_name }}FilterSet + filterset_form_class = forms.{{ cookiecutter.model_class_name }}FilterForm + form_class = forms.{{ cookiecutter.model_class_name }}Form + lookup_field = "pk" + queryset = models.{{ cookiecutter.model_class_name }}.objects.all() + serializer_class = serializers.{{ cookiecutter.model_class_name }}Serializer + table_class = tables.{{ cookiecutter.model_class_name }}Table diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py deleted file mode 100644 index 79dfcfde..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Plugin declaration for {{cookiecutter.plugin_name}}.""" -# Metadata is inherited from Nautobot. If not including Nautobot in the environment, this should be added -from importlib import metadata - -__version__ = metadata.version(__name__) - -from nautobot.apps import NautobotAppConfig - - -class {{cookiecutter.camel_name}}Config(NautobotAppConfig): - """Plugin configuration for the {{cookiecutter.plugin_name}} plugin.""" - - name = "{{cookiecutter.plugin_name}}" - verbose_name = "{{cookiecutter.verbose_name}}" - version = __version__ - author = "{{cookiecutter.full_name}}" - description = "{{cookiecutter.project_short_description}}." - base_url = "{{cookiecutter.base_url}}" - required_settings = [] - min_version = "{{cookiecutter.min_nautobot_version}}" - max_version = "{{cookiecutter.max_nautobot_version}}" - default_settings = {} - caching_config = {} - - -config = {{cookiecutter.camel_name}}Config # pylint:disable=invalid-name diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py deleted file mode 100644 index 85ab6d45..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""REST API module for {{cookiecutter.plugin_name}} plugin.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py deleted file mode 100644 index 646d52af..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Unit tests for {{cookiecutter.plugin_name}} plugin.""" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py deleted file mode 100644 index 9700eedd..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Views for {{ cookiecutter.plugin_name }}.""" -from nautobot.apps.views import NautobotUIViewSet - -from {{ cookiecutter.plugin_name }} import filters, forms, models, tables -from {{ cookiecutter.plugin_name }}.api import serializers - - -class {{ cookiecutter.model_class_name}}UIViewSet(NautobotUIViewSet): - """ViewSet for {{ cookiecutter.model_class_name}} views.""" - - bulk_update_form_class = forms.{{ cookiecutter.model_class_name}}BulkEditForm - filterset_class = filters.{{ cookiecutter.model_class_name}}FilterSet - filterset_form_class = forms.{{ cookiecutter.model_class_name}}FilterForm - form_class = forms.{{ cookiecutter.model_class_name}}Form - lookup_field = "pk" - queryset = models.{{ cookiecutter.model_class_name}}.objects.all() - serializer_class = serializers.{{ cookiecutter.model_class_name}}Serializer - table_class = tables.{{ cookiecutter.model_class_name}}Table From e4249fbd8e61c26d986a094f68fd6a579c57519c Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 15:32:04 -0600 Subject: [PATCH 09/15] add ignores for template files --- .yamllint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.yamllint.yml b/.yamllint.yml index 6eff02c0..8f4a44ac 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -12,3 +12,5 @@ ignore: | .venv/ nautobot-app/{{ cookiecutter.project_slug }}/invoke.mysql.yml nautobot-app/{{ cookiecutter.project_slug }}/invoke.example.yml + nautobot-app-ssot/{{ cookiecutter.project_slug }}/invoke.mysql.yml + nautobot-app-ssot/{{ cookiecutter.project_slug }}/invoke.example.yml From 0a4dca1be11a9e5e4867c640962f90c36e7eb3b2 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 15:55:35 -0600 Subject: [PATCH 10/15] fix broken symbolic links --- .../docs/images/icon-{{ cookiecutter.plugin_slug }}.png | 2 +- .../{{ cookiecutter.plugin_name }}/__init__.py | 2 +- .../{{ cookiecutter.plugin_name }}/api/__init__.py | 2 +- .../{{ cookiecutter.plugin_name }}/api/serializers.py | 2 +- .../{{ cookiecutter.plugin_name }}/api/urls.py | 2 +- .../{{ cookiecutter.plugin_name }}/api/views.py | 2 +- .../{{ cookiecutter.plugin_name }}/filters.py | 2 +- .../{{ cookiecutter.plugin_name }}/forms.py | 2 +- .../{{ cookiecutter.plugin_name }}/migrations/__init__.py | 2 +- .../{{ cookiecutter.plugin_name }}/models.py | 2 +- .../{{ cookiecutter.plugin_name }}/navigation.py | 2 +- .../{{ cookiecutter.plugin_name }}/tables.py | 2 +- .../{{ cookiecutter.model_class_name | lower }}_retrieve.html | 2 +- .../{{ cookiecutter.plugin_name }}/tests/__init__.py | 2 +- .../{{ cookiecutter.plugin_name }}/tests/fixtures.py | 2 +- .../{{ cookiecutter.plugin_name }}/tests/test_api.py | 2 +- .../{{ cookiecutter.plugin_name }}/tests/test_api_views.py | 2 +- .../{{ cookiecutter.plugin_name }}/tests/test_basic.py | 2 +- .../test_filter_{{ cookiecutter.model_class_name | lower }}.py | 2 +- .../test_form_{{ cookiecutter.model_class_name | lower }}.py | 2 +- .../test_model_{{ cookiecutter.model_class_name | lower }}.py | 2 +- .../{{ cookiecutter.plugin_name }}/tests/test_views.py | 2 +- .../{{ cookiecutter.plugin_name }}/urls.py | 2 +- .../{{ cookiecutter.plugin_name }}/views.py | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png index 9f10b533..96fd7ffa 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/docs/images/icon-{{cookiecutter.plugin_slug}}.png \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/docs/images/icon-{{ cookiecutter.plugin_slug }}.png \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py index 095b3119..06575aff 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/__init__.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py index 4f321064..9c7aa994 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/__init__.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/__init__.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py index 69d9969f..ffed85ab 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/serializers.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/serializers.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py index f00ac209..2b30ed95 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/urls.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/urls.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py index 41d7c8e4..1328b5b9 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/api/views.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/api/views.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py index 71fe9b1f..602d5a64 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/filters.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/filters.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py index 3eead31d..dbe36562 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/forms.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/forms.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py index 907f7543..e1aa7c68 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/migrations/__init__.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/migrations/__init__.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py index 2ecd6ece..3ba1e8ef 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/models.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/models.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py index 66a6198d..22a83ad8 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/navigation.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/navigation.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py index fe83e26e..7a68c7c4 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tables.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tables.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html index aef948cf..1fcbf878 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html @@ -1 +1 @@ -../../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/templates/{{cookiecutter.plugin_name}}/{{cookiecutter.model_class_name | lower }}_retrieve.html \ No newline at end of file +../../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/templates/{{ cookiecutter.plugin_name }}/{{ cookiecutter.model_class_name | lower }}_retrieve.html \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py index 3b4a0b03..34ead0b6 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/__init__.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/__init__.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py index c7e7d8f9..0aa7332e 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/fixtures.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/fixtures.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py index 32f136d8..c052b216 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py index a508daa1..ca2d630e 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_api_views.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_api_views.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py index 1fb7ce6e..44de1fc1 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_basic.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_basic.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py index c7448621..777fc6d8 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_filter_{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py index 50ce42a5..596ef71a 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_form_{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py index f7eea113..9f6fabf7 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_model_{{ cookiecutter.model_class_name | lower }}.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py index 3e481176..0423c9d9 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py @@ -1 +1 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/tests/test_views.py \ No newline at end of file +../../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_views.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py index ddc8bbc2..601b0293 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/urls.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/urls.py \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py index a404b3e1..fff61ea4 120000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py @@ -1 +1 @@ -../../../nautobot-app/{{ cookiecutter.project_slug }}/{{cookiecutter.plugin_name}}/views.py \ No newline at end of file +../../../nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/views.py \ No newline at end of file From 6a5c660c2fb5aae223489c5e9b548572258f8652 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 16:42:16 -0600 Subject: [PATCH 11/15] updates for v2 in ssot --- nautobot-app-ssot/cookiecutter.json | 4 +-- .../pyproject.toml | 6 +++- .../diffsync/models/base.py | 4 +-- .../diffsync/models/nautobot.py | 32 +++++++++++++------ ...cutter.system_of_record_slug }}_adapter.py | 4 +-- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/nautobot-app-ssot/cookiecutter.json b/nautobot-app-ssot/cookiecutter.json index 9b97b4fa..2a0f1337 100644 --- a/nautobot-app-ssot/cookiecutter.json +++ b/nautobot-app-ssot/cookiecutter.json @@ -12,8 +12,8 @@ "project_slug": "nautobot-plugin-ssot-{{ cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-') }}", "repo_url": "https://github.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}", "base_url": "ssot-{{ cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-') }}", - "min_nautobot_version": "1.6.0", - "max_nautobot_version": "1.9999", + "min_nautobot_version": "2.0.0", + "max_nautobot_version": "2.9999", "camel_name": "{{ cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '') }}", "project_short_description": "{{ cookiecutter.verbose_name }}", "model_class_name": "None", diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml index c3fdbf4c..75c8ca82 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml @@ -33,7 +33,7 @@ packages = [ python = ">=3.8,<3.12" # Used for local development nautobot = "^{{ cookiecutter.min_nautobot_version }}" -nautobot-ssot = "^1.1.0" +nautobot-ssot = "^2.0.0" [tool.poetry.group.dev.dependencies] bandit = "*" @@ -60,6 +60,10 @@ mkdocs-version-annotations = "1.0.0" mkdocstrings = "0.22.0" mkdocstrings-python = "1.5.2" +[tool.poetry.extras] +all = [ +] + [tool.black] line-length = 120 target-version = ['py38', 'py39', 'py310', 'py311'] diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/base.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/base.py index eb6d9dc8..360b82c7 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/base.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/base.py @@ -13,7 +13,7 @@ class Device(DiffSyncModel): "status", "role", "model", - "site", + "location", "ip_address", ) _children = {} @@ -22,7 +22,7 @@ class Device(DiffSyncModel): status: Optional[str] role: Optional[str] model: Optional[str] - site: Optional[str] + location: Optional[str] ip_address: Optional[str] uuid: Optional[UUID] diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/nautobot.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/nautobot.py index 3fd8a19e..7beea1fa 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/nautobot.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/diffsync/models/nautobot.py @@ -1,12 +1,26 @@ """Nautobot DiffSync models for {{ cookiecutter.system_of_record }} SSoT.""" -from diffsync import DiffSyncModel +from django.contrib.contenttypes.models import ContentType -from nautobot.dcim.models import Device as NewDevice -from nautobot.dcim.models import Site, DeviceRole, DeviceType -from nautobot.extras.models import Status +from nautobot.dcim.models import Device as NewDevice, Location, LocationType, DeviceType +from nautobot.extras.models import Status, Role from {{ cookiecutter.plugin_name }}.diffsync.models.base import Device +def ensure_location(location_name): + """Safely returns a Location with a LocationType that support Devices.""" + location_type, _ = LocationType.objects.get_or_create(name="Site") + content_type = ContentType.objects.get_for_model(NewDevice) + location_type.content_types.add(content_type) + status = Status.objects.get(name="Active") + return Location.objects.get_or_create(name=location_name, location_type=location_type, status=status)[0] + +def ensure_role(role_name): + """Safely returns a Role that support Devices.""" + content_type = ContentType.objects.get_for_model(NewDevice) + role, _ = Role.objects.get_or_create(name=role_name) + role.content_types.add(content_type) + return role + class NautobotDevice(Device): """Nautobot implementation of {{ cookiecutter.system_of_record }} Device model.""" @@ -17,8 +31,8 @@ def create(cls, diffsync, ids, attrs): name=ids["name"], device_type=DeviceType.objects.get_or_create(model=attrs["model"])[0], status=Status.objects.get_or_create(name=attrs["status"])[0], - device_role=DeviceRole.objects.get_or_create(name=attrs["role"])[0], - site=Site.objects.get_or_create(name=attrs["site"])[0], + role=ensure_role(attrs["role"]), + location=ensure_location(attrs["location"]), ) new_device.validated_save() return super().create(diffsync=diffsync, ids=ids, attrs=attrs) @@ -29,9 +43,9 @@ def update(self, attrs): if "status" in attrs: device.status = Status.objects.get_or_create(name=attrs["status"])[0] if "role" in attrs: - device.device_role = DeviceRole.objects.get_or_create(name=attrs["role"])[0] - if "site" in attrs: - device.site = Site.objects.get_or_create(name=attrs["site"])[0] + device.role = ensure_role(attrs["role"]) + if "location" in attrs: + device.location = ensure_location(attrs["location"]) device.validated_save() return super().update(attrs) diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py index 5a0859f5..3d68168d 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py @@ -6,7 +6,7 @@ from django.contrib.contenttypes.models import ContentType from nautobot.extras.models import Job, JobResult -from nautobot.utilities.testing import TransactionTestCase +from nautobot.core.testing import TransactionTestCase from {{ cookiecutter.plugin_name }}.diffsync.adapters.{{ cookiecutter.system_of_record_slug }} import {{ cookiecutter.system_of_record_camel }}Adapter from {{ cookiecutter.plugin_name }}.jobs import {{ cookiecutter.system_of_record_camel }}DataSource @@ -25,7 +25,7 @@ class Test{{ cookiecutter.system_of_record_camel }}AdapterTestCase(TransactionTe databases = ("default", "job_logs") - def setUp(self): + def setUp(self): # pylint: disable=invalid-name """Initialize test case.""" self.{{ cookiecutter.system_of_record_slug }}_client = MagicMock() self.{{ cookiecutter.system_of_record_slug }}_client.get_devices.return_value = DEVICE_FIXTURE From 61fb7abf96cc66db33f8639d85c636088a5abd43 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Mon, 4 Dec 2023 16:44:44 -0600 Subject: [PATCH 12/15] updates for v2 in ssot --- .../test_{{ cookiecutter.system_of_record_slug }}_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py index 3d68168d..004a1a21 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/tests/test_{{ cookiecutter.system_of_record_slug }}_adapter.py @@ -17,7 +17,7 @@ def load_json(path): return json.loads(file.read()) -DEVICE_FIXTURE = load_json("./{{ cookiecutter.plugin_name }}/tests/fixtures/fixtures/get_devices.json") +DEVICE_FIXTURE = load_json("./{{ cookiecutter.plugin_name }}/tests/fixtures/get_devices.json") class Test{{ cookiecutter.system_of_record_camel }}AdapterTestCase(TransactionTestCase): From 4f0dfb674cd24cee9f57d3116e98d32ce010ab50 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Tue, 5 Dec 2023 06:17:03 -0500 Subject: [PATCH 13/15] Update __init__.py Co-authored-by: Jan Snasel --- .../{{ cookiecutter.plugin_name }}/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py index a41d96d1..dbf1b429 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/{{ cookiecutter.plugin_name }}/__init__.py @@ -2,10 +2,10 @@ # Metadata is inherited from Nautobot. If not including Nautobot in the environment, this should be added from importlib import metadata -__version__ = metadata.version(__name__) - from nautobot.apps import NautobotAppConfig +__version__ = metadata.version(__name__) + class {{ cookiecutter.camel_name }}Config(NautobotAppConfig): """Plugin configuration for the {{ cookiecutter.plugin_name }} plugin.""" From fe18b8fd73df0b8ab3c4337f46381af6dce1e2f0 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Tue, 5 Dec 2023 07:04:11 -0500 Subject: [PATCH 14/15] add back trailling new line --- nautobot-app-ssot/cookiecutter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nautobot-app-ssot/cookiecutter.json b/nautobot-app-ssot/cookiecutter.json index 2a0f1337..40457bbf 100644 --- a/nautobot-app-ssot/cookiecutter.json +++ b/nautobot-app-ssot/cookiecutter.json @@ -23,4 +23,4 @@ ], "docs_base_url": "https://docs.nautobot.com", "docs_app_url": "{{ cookiecutter.docs_base_url }}/projects/{{ cookiecutter.plugin_slug }}/en/latest" -} \ No newline at end of file +} From f0fbbc580bb81a638cedfd89358c95563976e850 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Tue, 5 Dec 2023 14:02:46 -0500 Subject: [PATCH 15/15] Update nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md Co-authored-by: Cristian --- .../docs/admin/compatibility_matrix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md index 1830d4ac..eb4e5277 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/compatibility_matrix.md @@ -5,4 +5,4 @@ | {{ cookiecutter.verbose_name }} Version | Nautobot First Support Version | Nautobot Last Support Version | | ------------- | -------------------- | ------------- | -| 1.0.X | {{ cookiecutter.min_nautobot_version }} | 1.99.99 | +| 1.0.X | {{ cookiecutter.min_nautobot_version }} | 2.99.99 |