Is it possible in Django to reverse URLs within a reusable app such that the reversing will still work if the app is nested with another? It's essentially the same question as this stack overflow question <https://stackoverflow.com/questions/40709613/reverse-url-in-reusable-app-that-is-consumed-as-a-nested-app> but the answer there of moving the URLs into the root urlconf seems wrong to me. For example:
# app2 template {% url 'app2:test' %} # app2 urlconf app_name = "app2" urlpatterns = [ path("test", views.test_view.as_view(), name="test"), ] # app1 urlconf app_name = "app1" urlpatterns = [ path("", include("app2.urls")), ] # root urlconf urlpatterns = [ path("", include("app1.urls")), ] Attempting to render the app2 template currently results in a NoReverseMatch due to "app2" not being a registered namespace. If the app2 template is overridden in app1 to instead use: {% url 'app1:app2:test' %} the reverse issue goes away. It seems like there should be a way to mitigate this issue without overriding the app2 template in app1. Is it not a valid use case for reusable apps to nest the url patterns of other reusable apps within themselves without expecting to have to override all places where a URL reverse is done in the nested reusable app? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fa8d7f73-bcbd-43a7-bfe8-a0c0c6bd1fcb%40googlegroups.com.