Opened 7 years ago
Closed 7 years ago
#29361 closed Cleanup/optimization (wontfix)
django.contrib.flatpages.urls does not have an app_name attribute
Reported by: | William Morrell | Owned by: | nobody |
---|---|---|---|
Component: | contrib.flatpages | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In 2.0, the include function in django.urls changed to drop the app_name argument, but an app_name attribute to the urls module is still required when setting a namespace on an include call. The urls.py in contrib.flatpages does not include an app_name attribute, so code like this will break:
urlpatterns = [ # ... path('my-flat-pages/', include('django.contrib.flatpages.urls', namespace='my-custom-namespace')), ]
Note:
See TracTickets
for help on using tickets.
You're right: there is no
app_name
but we can't just introduce one, since that would break existing usages.If you want to namespace the URLs you can use the third case from the `include()` docs:
Assuming you don't also need a instance namespace, you'd do something like: