Opened 12 months ago
Last modified 12 months ago
#35966 closed New feature
Support `check` for invalid `template_name` string in `TemplateView` and other related types — at Initial Version
| Reported by: | Sobolev Nikita | Owned by: | |
|---|---|---|---|
| Component: | Core (System checks) | Version: | 5.1 |
| Severity: | Normal | Keywords: | checks, views, template_name |
| Cc: | Sobolev Nikita | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
python manage.py check helps us to find a lot of problems before actually running the project itself / tests for it.
I think that one thing that we can also check statically is template_name strings in different views that we have set-up in urls.
These templates can be found using regular Django machinery and help finging issues sooner.
Basically, I expect:
`python
from django.views.generic import TemplateView
class MyView(TemplateView):
template_name = 'my.html'
`
to raise an error during python manage.py check if my.html cannot be found with TEMPLATE loader settings. When MyView is present in urls.py as:
`python
urlpatterns = [
path('/whatever', MyView.as_view(), name='whatever'),
]
`
What do others think?