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

Make urls.py a file that is always baked #198

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion nautobot-app/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"tests/test_form_{{ cookiecutter.model_class_name.lower() }}.py",
"tests/test_model_{{ cookiecutter.model_class_name.lower() }}.py",
"tests/test_views.py",
"urls.py",
"views.py",
]
for file in files_to_remove:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
from django.views.generic import RedirectView
from nautobot.apps.urls import NautobotUIViewSetRouter

{% if cookiecutter.model_class_name != "None" %}
from {{ cookiecutter.app_name }} import views
{% else %}
# Uncomment the following line if you have views to import
# from {{ cookiecutter.app_name }} import views
{% endif %}

router = NautobotUIViewSetRouter()
{% if cookiecutter.model_class_name != "None" %}
router.register("{{ cookiecutter.model_class_name | lower }}", views.{{ cookiecutter.model_class_name }}UIViewSet)
{% else %}
# Here is an example of how to register a viewset, you will want to replace views.{{ cookiecutter.camel_name }}UIViewSet with your viewset
# router.register("{{ cookiecutter.app_name }}", views.{{ cookiecutter.camel_name }}UIViewSet)
{% endif %}

urlpatterns = [
path("docs/", RedirectView.as_view(url=static("{{ cookiecutter.app_name }}/docs/index.html")), name="docs"),
Expand Down
Loading