nautobot / cookiecutter-nautobot-app

Cookiecutter template for creating new Nautobot Apps.
https://docs.nautobot.com/projects/cookiecutter-nautobot-app/en/latest/
Apache License 2.0
16 stars 5 forks source link

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

Closed smk4664 closed 1 day ago

smk4664 commented 2 days ago

Closes #196

Post Bake of urls.py with model_class_name==None:

"""Django urlpatterns declaration for test_app app."""

from django.templatetags.static import static
from django.urls import path
from django.views.generic import RedirectView
from nautobot.apps.urls import NautobotUIViewSetRouter

# Uncomment the following line if you have views to import
# from test_app import views

router = NautobotUIViewSetRouter()

# Here is an example of how to register a viewset, you will want to replace views.TestAppUIViewSet with your viewset
# router.register("test_app", views.TestAppUIViewSet)

urlpatterns = [
    path("docs/", RedirectView.as_view(url=static("test_app/docs/index.html")), name="docs"),
]

urlpatterns += router.urls

DRF does not complain when providing a router with no viewsets.

image