#35966: Support `check` for invalid `template_name` string in `TemplateView` and
other related types
-------------------------------------+-------------------------------------
Reporter: Sobolev Nikita | Type: New
| feature
Status: new | Component: Core
| (Management commands)
Version: 5.1 | Severity: Normal
Keywords: checks, views, | Triage Stage:
template_name | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
`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?
--
Ticket URL: <https://code.djangoproject.com/ticket/35966>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701938b926897-184729a8-ea0d-443e-9806-e6b184806a95-000000%40eu-central-1.amazonses.com.