#35966: Support `check` for invalid `template_name` string in `TemplateView` and
other related types
-------------------------------------+-------------------------------------
Reporter: Sobolev Nikita | Owner: (none)
Type: New feature | Status: new
Component: Core (Management | Version: 5.1
commands) |
Severity: Normal | Resolution:
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
-------------------------------------+-------------------------------------
Description changed by Sobolev Nikita:
Old 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?
New 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:
{{{
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:
{{{
urlpatterns = [
path('/whatever', MyView.as_view(), name='whatever'),
]
}}}
What do others think?
--
--
Ticket URL: <https://code.djangoproject.com/ticket/35966#comment:1>
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/010701938b92ff01-cdb39aaa-0b98-4b76-9395-270ffc5abbc2-000000%40eu-central-1.amazonses.com.