Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Refs #6737 -- Add test for apphooks urls config check * Fixed #6737 -- Fix 'urls.W001' warning with custom apphook urls When rewriting the apphooks urls in appresolver.recurse_patterns, the original RegexPattern.is_endpoint flag is lost, so urls with a callback view throws an "include with a route ending with a '$'" warning ('urls.W001'). @apphook_pool.register class MyApp(CMSApp): name = "MyApp" def get_urls(self, page=None, language=None, **kwargs): return [ re_path(r"^$", views.MyAppView.as_view(), name="my-app-index") # or this # path(r"", views.MyAppView.as_view(), name="my-app-index") ] $ ./manage.py check System check identified some issues: WARNINGS: ?: (urls.W001) Your URL pattern '^my-app-url/my-view-url/$' [name='my-app-index'] uses include with a route ending with a '$'. Remove the dollar from the route to avoid problems including URLs. This fix set the RegexPattern flag is_endpoint to True for callback views in appresolver.recurse_patterns as in https://github.com/django/django/blob/stable/2.2.x/django/urls/conf.py#L70
- Loading branch information