Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] v1.4.0 Code Review #2046

Closed
wants to merge 134 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
b81c64f
Version bump to v1.4.0-alpha.0, seeded next version in docs.
bryanculver Apr 19, 2022
5c9da70
Fix lint in 1.4 release notes
bryanculver Apr 19, 2022
95aba9a
Merge branch 'develop' into next
bryanculver Apr 19, 2022
0ed5d4d
Merge branch 'develop' into next
bryanculver Apr 24, 2022
19fd4a8
Merge branch 'develop' into next
bryanculver Apr 26, 2022
dd7e49c
Merge branch 'develop' into next
bryanculver May 2, 2022
379a901
Merge branch 'develop' into next
bryanculver May 17, 2022
dc5c08e
Add Status field to Interface, VMInterface (#1753)
timizuoebideri1 May 20, 2022
a40b93f
Add release-note for #984
bryanculver May 20, 2022
e9b5505
Fix Markdownlint Issue
bryanculver May 20, 2022
805047a
Merge branch 'develop' into next
jathanism May 23, 2022
ee5818f
Add back some code that was inadvertently removed in the merge
glennmatthews May 24, 2022
61d43f9
Add dark mode (#1554)
matt852 May 24, 2022
2eb4a52
Add release-note for #729
bryanculver May 24, 2022
6087627
Reject unrecognized filter parameters in UI and API (#1736) (#1794)
glennmatthews May 26, 2022
432437d
Fix footer italics for theme button (#1816)
matt852 May 26, 2022
2b2be16
Add release-note for #1815
bryanculver May 26, 2022
c63eec2
Merge branch 'develop' into next
bryanculver May 31, 2022
80cf286
Physical Interfaces Parenting Virtual Interfaces (#1651)
timizuoebideri1 May 31, 2022
86e3eb9
Add release-note for #1455
glennmatthews May 31, 2022
5c42d82
Merge branch 'develop' into next
bryanculver Jun 2, 2022
89fbf1f
Add hyperlinked_object helper template-tag, update templates accordin…
glennmatthews Jun 2, 2022
65d26cd
Rackview UI Add Option to Truncate Device Name (#1824)
bryanculver Jun 2, 2022
ab33fee
Merge branch 'develop' into next
bryanculver Jun 6, 2022
bba0cf3
Add parent interface and bridge to interface serializer v1.4 (#1834)
timizuoebideri1 Jun 7, 2022
ce4cb8e
Add release-note for #1831
bryanculver Jun 7, 2022
f0c111b
Marked possible index opportunities so far (#1793)
briddo Jun 8, 2022
aa5cd1b
Add release-note for #1793
bryanculver Jun 8, 2022
4419ddd
Merge branch 'develop' into next
bryanculver Jun 13, 2022
232b859
Add date to alpha release date
bryanculver Jun 13, 2022
43b8511
Denote alpha.1, not 0
bryanculver Jun 13, 2022
076a6d8
Version bump to v1.4.0-alpha.2, seeded next version in docs.
bryanculver Jun 14, 2022
7708400
Plugin extra object detail tabs (#1843)
briddo Jun 16, 2022
26d05ae
Remove Job Source Tab from Job and Job Result View (#1895)
HanlinMiao Jun 16, 2022
17e439b
Relationship detail view (#1894)
whitej6 Jun 16, 2022
a36ed89
Add release-note for #1462, #1893
bryanculver Jun 16, 2022
86ffe5c
Update dependency Markdown to ~3.3.7 (#1908)
renovate[bot] Jun 17, 2022
d852288
Update dependency MarkupSafe to ~2.1.1 (#1909)
renovate[bot] Jun 17, 2022
120ca65
Update dependency celery to ~5.2.7 (#1912)
renovate[bot] Jun 17, 2022
d4f5299
Update dependency django-jinja to ~2.10.2 (#1913)
renovate[bot] Jun 17, 2022
0754865
Update dependency svgwrite to ~1.4.2 (#1917)
renovate[bot] Jun 18, 2022
9ee1a9d
Update dependency django-debug-toolbar to ~3.4.0 (#1925)
renovate[bot] Jun 19, 2022
cc6a167
Update dependency django-cors-headers to ~3.13.0 (#1924)
renovate[bot] Jun 19, 2022
9d53ee6
Update dependency django-auth-ldap to ~4.1.0 (#1921)
renovate[bot] Jun 20, 2022
5e02620
Update dependency coverage to ~6.4.1 (#1920)
renovate[bot] Jun 20, 2022
2dcfc7f
Update dependency Pillow to ~9.1.1 (#1919)
renovate[bot] Jun 20, 2022
a5afdb8
Update dependency napalm to ~3.4.1 (#1928)
renovate[bot] Jun 20, 2022
a3b183b
Update dependency selenium to ~4.2.0 (#1929)
renovate[bot] Jun 20, 2022
62a7fde
Update dependency invoke to ~1.7.1 (#1915)
renovate[bot] Jun 20, 2022
19863f9
Add missing model fields to DCIM filter sets (#1853)
gsnider2195 Jun 22, 2022
943af07
add release notes for #1729
gsnider2195 Jun 22, 2022
93df143
Fix #1898 - Browsable API is now styled like the rest of the app (#1899)
jathanism Jun 23, 2022
37175c9
Added release-notes for #1898
jathanism Jun 23, 2022
5847c07
Add release-note for bulk of Renovate Bot initial PRs
bryanculver Jun 23, 2022
db153ef
change SlugOrPKMultipleChoiceFilter to NaturalKeyOrPKMultipleChoiceFi…
gsnider2195 Jun 24, 2022
cc5a826
update release notes for 1729
gsnider2195 Jun 24, 2022
db8ce7e
Merge branch 'develop' into next
bryanculver Jun 27, 2022
4576532
Add migration notice
bryanculver Jun 27, 2022
2dd4378
Update dependency splinter to ~0.18.0 (#1932)
renovate[bot] Jun 28, 2022
eda4157
Update dependency selenium to ~4.3.0 (#1955)
renovate[bot] Jun 28, 2022
cc0d0a7
Update dependency splinter to v0.18.1 (#1975)
renovate[bot] Jun 29, 2022
bb3f35c
Prototype Locations implementation (#1891)
glennmatthews Jul 1, 2022
cd8a58e
Add release-note for #1052
glennmatthews Jul 1, 2022
2fbe298
Create TestCaseMixin for Helper Functions Across All Test Case Bases …
smk4664 Jul 7, 2022
07b2d6c
Add missing filters to DCIM FilterSets (2nd round) (#1981)
gsnider2195 Jul 8, 2022
571fff3
Add release-note for #1729
gsnider2195 Jul 8, 2022
e512db3
Merge branch 'develop' into next
bryanculver Jul 11, 2022
d602f8e
Bulk-edit Support for Associated Relationships (#2014)
glennmatthews Jul 12, 2022
14eaf7c
Fix #2002 - remove RQ worker container from docker-compose default en…
glennmatthews Jul 12, 2022
b0150b6
Fix #1945: Remove registry from default template context, provide tem…
glennmatthews Jul 12, 2022
a413b14
Add release-note for #1945, #1949, #2002
bryanculver Jul 12, 2022
549096c
Fix merge from develop breaking build in next. (#2037)
bryanculver Jul 12, 2022
7ee6c00
Add Plugin Ability to Override Views (Core and Plugin) (#1957)
briddo Jul 12, 2022
b610589
Version bump to v1.4.0-alpha.3, seeded next version in docs.
bryanculver Jul 12, 2022
2900c79
Update object change context manager to be aware of the change source…
gsnider2195 Jul 12, 2022
d4ea3cd
add release note for #2035
gsnider2195 Jul 12, 2022
716460d
Add Changelog Url for Relationships (#2055)
smk4664 Jul 14, 2022
31c0405
Add Support for Custom JS/CSS on Job Schedule Form (#1866)
tbotnz Jul 14, 2022
27e7f61
Add Missing Model Fields to Virtualization Filter Sets (#1938)
timizuoebideri1 Jul 14, 2022
b34dbb3
Add release-note for #1735, #1865, #2051. Added docs for Job
bryanculver Jul 14, 2022
927432f
Fix Markdownlint issue
bryanculver Jul 14, 2022
753087e
Remove more lint
bryanculver Jul 14, 2022
8a6df7f
Markdown not rendered HTML
bryanculver Jul 15, 2022
23ff79f
Add get_changelog_url Method to Objects that Support Changelogs (#2049)
bryanculver Jul 15, 2022
0ab5be1
Add release-note for #2049
bryanculver Jul 15, 2022
0bf77a4
[MVP] Dynamic Groups of Groups (#1785)
jathanism Jul 15, 2022
fc9b149
Dynamic Group of Groups: Add draggable child groups, recompute and hi…
bryanculver Jul 19, 2022
8958bc3
Added release-notes for #1614, #1710, and #2061
jathanism Jul 19, 2022
b19e85b
Merge branch 'develop' into next
jathanism Jul 20, 2022
61b2aa6
Added release-notes for #2072
jathanism Jul 20, 2022
5961291
Test fix (#2083)
briddo Jul 21, 2022
35c028c
Store `job_kwargs` on JobResult Model, Add "Re-run" Button on Job Res…
tbotnz Jul 21, 2022
68bf0d3
Added release-notes for #1875
jathanism Jul 21, 2022
5382141
fix failing markdownlint
gsnider2195 Jul 21, 2022
df90685
Add Relationship Filtering to Relationship-Capable Model FilterSets, …
HanlinMiao Jul 25, 2022
29d0126
added documentations for issues #1883 and #1884
Jul 25, 2022
fac90d2
Create JobHookReceiver subclass of Job (#2056)
gsnider2195 Jul 26, 2022
e038792
add release note for #1877
gsnider2195 Jul 26, 2022
e10f3a1
Merge branch 'develop' into next
bryanculver Jul 27, 2022
ac46e8a
fixed one to many relationship source filter and apply AND operator b…
HanlinMiao Jul 28, 2022
9b77295
updated documentations for #2109 and #2111
Jul 28, 2022
96ac629
Add missing location status migration (#2100)
glennmatthews Jul 29, 2022
ecadb72
Implement Notes Model (#1984)
smk4664 Jul 29, 2022
8745bc0
Merge branch 'develop' into next
bryanculver Jul 29, 2022
c23e364
Re-ordered migrations
bryanculver Jul 29, 2022
3d5aabc
Update Releases Batched for Next (next) (#2116)
renovate[bot] Jul 29, 2022
3ce3433
Add release-note for #2116
bryanculver Jul 29, 2022
d50810a
Include relationships and associations on object REST APIs (#2092)
glennmatthews Jul 29, 2022
a51b148
Dynamic Groups UX improvements (#2079)
jathanism Jul 29, 2022
feadb66
Added release-notes for #1614, #2069 (Dynamic Groups of Dynamic Groups)
jathanism Jul 29, 2022
f3ef08b
Add Job Hooks (#2103)
gsnider2195 Jul 29, 2022
dbc3e1e
add release note for #2103
gsnider2195 Jul 29, 2022
2db42c3
Merge branch 'develop' into next
bryanculver Jul 30, 2022
e49c7c4
Version bump to v1.4.0-beta.1, update changelog
bryanculver Jul 30, 2022
ac73834
update job hook to use slug in urls (#2132)
gsnider2195 Aug 2, 2022
a34cc15
add release note for #2132
gsnider2195 Aug 2, 2022
ffbbd3f
update job hook docs, move to docs/models/extras (#2133)
gsnider2195 Aug 2, 2022
d88bad6
Naturalkey docs (#2138)
smk4664 Aug 5, 2022
9f9582c
Fix URL generation for relationships nested API (#2142)
glennmatthews Aug 5, 2022
ff05c82
Add release-notes for #2133, #2137, #2142
glennmatthews Aug 5, 2022
d576004
Add slug field to CustomField model, add versioned custom-fields REST…
glennmatthews Aug 5, 2022
2c25678
Bug fixes and add missing API functionality for Dynamic Group Members…
jathanism Aug 6, 2022
5710763
Extending filtering of date custom field type (#2126)
briddo Aug 8, 2022
bf6d49d
fix ObjectChange missing user object when making changes through API …
gsnider2195 Aug 9, 2022
263e956
Merge branch 'develop' into next
bryanculver Aug 9, 2022
8f7fa72
Only populate statuses on Integration TestCases. (#2160)
smk4664 Aug 10, 2022
541a7b4
Fix release note for #2150
bryanculver Aug 10, 2022
ab0189c
Notes api (#2120)
smk4664 Aug 10, 2022
4f8035f
Add release-note for #2106
bryanculver Aug 10, 2022
c5c4d3d
Fix #2090: don't reset Tag content-types on a PATCH (#2164)
glennmatthews Aug 10, 2022
df9cc81
Fix missing RelationshipModelForm class, add @class_deprecated_in_fav…
glennmatthews Aug 10, 2022
b155ab5
Fix up relationship-association API test issue (#2165)
glennmatthews Aug 10, 2022
0d1b805
Add release-note for #2165
bryanculver Aug 10, 2022
f9de4ab
Paused CI hold off churn while we do a static code review.
bryanculver Jul 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
500 changes: 254 additions & 246 deletions .github/workflows/ci_pullrequest.yml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions development/docker-compose.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ services:
- "curl"
- "-fk"
- "https://localhost:8443/health/"
worker:
image: "networktocode/nautobot-py${PYTHON_VER}:local"
celery_worker:
image: "networktocode/nautobot-py${PYTHON_VER}:local"
2 changes: 1 addition & 1 deletion development/docker-compose.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
volumes:
- ./nautobot_config.py:/opt/nautobot/nautobot_config.py
- ../:/source
worker:
celery_worker:
volumes:
- ./nautobot_config.py:/opt/nautobot/nautobot_config.py
- ../:/source
4 changes: 0 additions & 4 deletions development/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ services:
volumes:
- ./nautobot_config.py:/opt/nautobot/nautobot_config.py
- ../:/source
worker:
volumes:
- ./nautobot_config.py:/opt/nautobot/nautobot_config.py
- ../:/source
celery_worker:
volumes:
- ./nautobot_config.py:/opt/nautobot/nautobot_config.py
Expand Down
3 changes: 0 additions & 3 deletions development/docker-compose.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ services:
nautobot:
environment:
- "NAUTOBOT_DB_ENGINE=django.db.backends.mysql"
worker:
environment:
- "NAUTOBOT_DB_ENGINE=django.db.backends.mysql"
celery_worker:
environment:
- "NAUTOBOT_DB_ENGINE=django.db.backends.mysql"
Expand Down
17 changes: 2 additions & 15 deletions development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@ services:
- "curl"
- "-f"
- "http://localhost:8080/health/"
worker:
image: "networktocode/nautobot-dev-py${PYTHON_VER}:local"
entrypoint: "nautobot-server rqworker"
healthcheck:
interval: 60s
timeout: 30s
start_period: 5s
retries: 3
test: ["CMD", "nautobot-server", "health_check"]
depends_on:
- nautobot
env_file:
- ./dev.env
tty: true
celery_worker:
image: "networktocode/nautobot-dev-py${PYTHON_VER}:local"
entrypoint: "nautobot-server celery worker -l INFO"
Expand Down Expand Up @@ -89,6 +75,7 @@ services:
image: selenium/standalone-firefox:4.1.2
ports:
- "4444:4444"
- "15900:5900"
shm_size: 2g
mkdocs:
profiles:
Expand All @@ -99,4 +86,4 @@ services:
disable: true
tty: true
ports:
- "8001:8001"
- "8001:8001"
4 changes: 0 additions & 4 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
"handlers": ["verbose_console" if DEBUG else "normal_console"],
"level": LOG_LEVEL,
},
"rq.worker": {
"handlers": ["verbose_console" if DEBUG else "normal_console"],
"level": LOG_LEVEL,
},
},
}

Expand Down
4 changes: 0 additions & 4 deletions docker/nautobot_config.append.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,5 @@
"handlers": ["normal_console"],
"level": LOG_LEVEL,
},
"rq.worker": {
"handlers": ["normal_console"],
"level": LOG_LEVEL,
},
},
}
5 changes: 3 additions & 2 deletions examples/example_plugin/example_plugin/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from rest_framework import serializers

from nautobot.core.api import ValidatedModelSerializer, WritableNestedSerializer
from nautobot.core.api import WritableNestedSerializer
from nautobot.extras.api.serializers import NautobotModelSerializer

from example_plugin.models import ExampleModel


class ExampleModelSerializer(ValidatedModelSerializer):
class ExampleModelSerializer(NautobotModelSerializer):
"""Used for normal CRUD operations."""

url = serializers.HyperlinkedIdentityField(view_name="plugins-api:example_plugin-api:examplemodel-detail")
Expand Down
4 changes: 2 additions & 2 deletions examples/example_plugin/example_plugin/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from rest_framework.response import Response
from rest_framework.views import APIView

from nautobot.core.api.views import ModelViewSet
from nautobot.extras.api.views import NautobotModelViewSet

from example_plugin.api.serializers import ExampleModelSerializer
from example_plugin.filters import ExampleModelFilterSet
from example_plugin.models import ExampleModel


class ExampleModelViewSet(ModelViewSet):
class ExampleModelViewSet(NautobotModelViewSet):
queryset = ExampleModel.objects.all()
serializer_class = ExampleModelSerializer
filterset_class = ExampleModelFilterSet
Expand Down
42 changes: 40 additions & 2 deletions examples/example_plugin/example_plugin/jobs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import time

from nautobot.extras.jobs import IntegerVar, Job
from nautobot.extras.choices import ObjectChangeActionChoices
from nautobot.extras.jobs import IntegerVar, Job, JobHookReceiver


name = "ExamplePlugin jobs"


class ExampleJob(Job):

# specify template_name to override the default job scheduling template
template_name = "example_plugin/example_with_custom_template.html"

class Meta:
name = "Example job, does nothing"
description = """
Expand Down Expand Up @@ -40,4 +45,37 @@ def run(self, data, commit):
return f"Ran for {interval} seconds"


jobs = (ExampleJob, ExampleHiddenJob, ExampleLoggingJob)
class ExampleJobHookReceiver(JobHookReceiver):
class Meta:
name = "Example job hook receiver"
description = "Validate changes to object serial field"

def receive_job_hook(self, change, action, changed_object):
# return on delete action
if action == ObjectChangeActionChoices.ACTION_DELETE:
return

# log diff output
snapshots = change.get_snapshots()
self.log_info(f"DIFF: {snapshots['differences']}")

# validate changes to serial field
if "serial" in snapshots["differences"]["added"]:
old_serial = snapshots["differences"]["removed"]["serial"]
new_serial = snapshots["differences"]["added"]["serial"]
self.log_info(f"{changed_object} serial has been changed from {old_serial} to {new_serial}")

# Check the new serial is valid and revert if necessary
if not self.validate_serial(new_serial):
changed_object.serial = old_serial
changed_object.save()
self.log_info(f"{changed_object} serial {new_serial} was not valid. Reverted to {old_serial}")

self.log_success(message=f"Serial validation completed for {changed_object}")

def validate_serial(self, serial):
# add business logic to validate serial
return False


jobs = (ExampleJob, ExampleHiddenJob, ExampleLoggingJob, ExampleJobHookReceiver)
3 changes: 2 additions & 1 deletion examples/example_plugin/example_plugin/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def nautobot_database_ready_callback(sender, *, apps, **kwargs):
from nautobot.extras.choices import CustomFieldTypeChoices

field, _ = CustomField.objects.update_or_create(
name="example-plugin-auto-custom-field",
name="example_plugin_auto_custom_field", # Effectively a slug, will go away in a future Nautobot release
slug="example_plugin_auto_custom_field", # Note underscores rather than dashes!
defaults={
"type": CustomFieldTypeChoices.TYPE_TEXT,
"label": "Example Plugin Automatically Added Custom Field",
Expand Down
58 changes: 57 additions & 1 deletion examples/example_plugin/example_plugin/template_content.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,62 @@
from django.urls import reverse

from nautobot.extras.plugins import PluginTemplateExtension


class CircuitContent(PluginTemplateExtension):
model = "circuits.circuit"

def detail_tabs(self):
"""
You may define extra tabs to render on a model's detail page by utilizing this method.
Each tab is defined as a dict in a list of dicts.

For each of the tabs defined:
- The <title> key's value will become the tab link's title.
- The <url> key's value is used to render the HTML link for the tab.

Since the `model` attribute of this class is set as "circuits.circuit",
these tabs will be added to the Circuit model's detail page.

This example demonstrates defining one tab.
"""
return [
{
"title": "Plugin Tab",
"url": reverse("plugins:example_plugin:circuit_detail_tab", kwargs={"pk": self.context["object"].pk}),
},
]


class DeviceContent(PluginTemplateExtension):
model = "dcim.device"

def detail_tabs(self):
"""
You may define extra tabs to render on a model's detail page by utilizing this method.
Each tab is defined as a dict in a list of dicts.

For each of the tabs defined:
- The <title> key's value will become the tab link's title.
- The <url> key's value is used to render the HTML link for the tab

Since the `model` attribute of this class is set as "dcim.device",
these tabs will be added to the Device model's detail page.

This example demonstrates defining two tabs. The tabs will be ordered by their position in list.
"""
return [
{
"title": "Plugin Tab 1",
"url": reverse("plugins:example_plugin:device_detail_tab_1", kwargs={"pk": self.context["object"].pk}),
},
{
"title": "Plugin Tab 2",
"url": reverse("plugins:example_plugin:device_detail_tab_2", kwargs={"pk": self.context["object"].pk}),
},
]


class SiteContent(PluginTemplateExtension):
model = "dcim.site"

Expand Down Expand Up @@ -64,4 +120,4 @@ def buttons(self):


# Don't forget to register your template extensions!
template_extensions = [ExampleModelContent, SiteContent]
template_extensions = [ExampleModelContent, SiteContent, CircuitContent, DeviceContent]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'extras/job.html' %}
{% block content %}
<div class="row">
<div class="col-md-12">
This is custom content injected by this specific plugin-provided Job
</div>
</div>
{{ block.super }}
{% endblock content %}
{% block javascript %}
{{ block.super }}
<script>
console.log("This job from the example_plugin is injecting custom JavaScript");
</script>
{% endblock javascript %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends 'circuits/circuit.html' %}
bryanculver marked this conversation as resolved.
Show resolved Hide resolved

{% block content %}
<h2>Circuit Plugin Tab</h2>
<p>I am some content for the example plugin's circuit ({{ object.pk }}) detail tab.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends 'dcim/device.html' %}
bryanculver marked this conversation as resolved.
Show resolved Hide resolved

{% block content %}
<h2>Device Plugin Tab 1</h2>
<p>I am some content for the example plugin's device ({{ object.pk }}) detail tab 1.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends 'dcim/device.html' %}
bryanculver marked this conversation as resolved.
Show resolved Hide resolved

{% block content %}
<h2>Device Plugin Tab 2</h2>
<p>I am some content for the example plugin's device ({{ object.pk }}) detail tab 2.</p>
{% endblock %}
30 changes: 29 additions & 1 deletion examples/example_plugin/example_plugin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.urls import path
from django.views.generic import RedirectView

from nautobot.extras.views import ObjectChangeLogView
from nautobot.extras.views import ObjectChangeLogView, ObjectNotesView

from example_plugin import views
from example_plugin.models import AnotherExampleModel, ExampleModel
Expand Down Expand Up @@ -47,6 +47,12 @@
name="examplemodel_changelog",
kwargs={"model": ExampleModel},
),
path(
"models/<uuid:pk>/notes/",
ObjectNotesView.as_view(),
name="examplemodel_notes",
kwargs={"model": ExampleModel},
),
path("other-models/", views.AnotherExampleModelListView.as_view(), name="anotherexamplemodel_list"),
path("other-models/add/", views.AnotherExampleModelEditView.as_view(), name="anotherexamplemodel_add"),
path(
Expand Down Expand Up @@ -76,9 +82,31 @@
name="anotherexamplemodel_changelog",
kwargs={"model": AnotherExampleModel},
),
path(
"other-models/<uuid:pk>/notes/",
ObjectNotesView.as_view(),
name="anotherexamplemodel_notes",
kwargs={"model": AnotherExampleModel},
),
path(
"docs/",
RedirectView.as_view(url=static("example_plugin/docs/index.html")),
name="docs",
),
path(
"circuits/<uuid:pk>/example-plugin-tab/", views.CircuitDetailPluginTabView.as_view(), name="circuit_detail_tab"
),
path(
"devices/<uuid:pk>/example-plugin-tab-1/",
views.DeviceDetailPluginTabOneView.as_view(),
name="device_detail_tab_1",
),
path(
"devices/<uuid:pk>/example-plugin-tab-2/",
views.DeviceDetailPluginTabTwoView.as_view(),
name="device_detail_tab_2",
),
# This URL definition is here in order to test the override_views functionality which is defined
# in examples.plugin_with_view_override.plugin_with_view_override.views
path("override-target/", views.ViewToBeOverridden.as_view(), name="view_to_be_overridden"),
]