-
Notifications
You must be signed in to change notification settings - Fork 263
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
Test and officially bless generic views for use by plugins #474
Test and officially bless generic views for use by plugins #474
Conversation
- Added a `README.md` and a `pyproject.toml` for it - Added it as a dev dependency to nautobot's root `pyproject.toml` - Asserted that unit tests ran: ``` Creating test database for alias 'default'... System check identified no issues (0 silenced). ..................... ---------------------------------------------------------------------- Ran 21 tests in 0.134s OK Destroying test database for alias 'default'... ```
- Added URLs and everything - Added a detail view template - Added tables, filters, forms, search, changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great start!
verbose_name = "Dummy plugin" | ||
version = "0.0" | ||
description = "For testing purposes only" | ||
base_url = "dummy-plugin" | ||
min_version = "0.9" | ||
max_version = "9.0" | ||
middleware = ["nautobot.extras.tests.dummy_plugin.middleware.DummyMiddleware"] | ||
middleware = ["dummy_plugin.middleware.DummyMiddleware"] | ||
installed_apps = ["nautobot.extras.tests.dummy_plugin_dependency"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the installed_app going to get moved to examples
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on the fence about the dummy dependency moving.
- Add a version string to the plugin - Added a `to_csv()` method to `DummyModel`
- Updated plugin code quite a bit to use correct bases for API serializers/views to get all tests passing - Changed base of API `DummyModelViewSet` to use `nautobot.core.api.views.ModelViewSet` - Changed base of API `DummyModelSerializer` to use `nautobot.core.api.serializers.ValidatedModelSerializer` - Added `url` field to API `DummyModelSerializer` - Switched API urls to use `nautobot.core.api.OrderedDefaultRouter` to get bulk update/delete working correctly. - Updated Invoke tasks to also run black/flake8 on `examples/` - Added a `poetry.lock` file for `dummy_plugin`
examples/dummy_plugin/dummy_plugin/templates/dummy_plugin/dummymodel.html
Outdated
Show resolved
Hide resolved
examples/dummy_plugin/dummy_plugin/templates/dummy_plugin/dummymodel.html
Show resolved
Hide resolved
- Got rid of relative imports just for the sake of clarity and consistency - Made sure that bulk edit/delete UI operations are properly tested. - Added a nested API serializer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Would it make sense to add anything in nautobot/docs
that points to the dummy plugin? Maybe not since the docs are hosted separately from the repository, but wanted to see what you think.
I think it would make sense to include such documentation along side the plugin development docs maybe? |
Fixes: #14
Moved
dummy_plugin
toexamples/dummy_plugin
at project rootREADME.md
and apyproject.toml
for itpyproject.toml
to_csv()
method toDummyModel
DummyModelViewSet
to usenautobot.core.api.views.ModelViewSet
DummyModelSerializer
to usenautobot.core.api.serializers.ValidatedModelSerializer
url
field to APIDummyModelSerializer
nautobot.core.api.OrderedDefaultRouter
to get bulk update/delete working correctly.examples/
poetry.lock
file fordummy_plugin