#32987: Warn user if they attempt to have mulitple templatetag libraries with 
the
same name
---------------------------------+--------------------------------------
     Reporter:  Daniel           |                    Owner:  nobody
         Type:  New feature      |                   Status:  new
    Component:  Template system  |                  Version:  3.2
     Severity:  Normal           |               Resolution:
     Keywords:  template, check  |             Triage Stage:  Unreviewed
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------
Description changed by Daniel:

Old description:

> For example, if you have:
>
> - blog/templatetags/navigation_tags.py
> - news/templatetags/navigation_tags.py
> - pages/templatetags/navigation_tags.py
>
> then try to use them in a template:
>

> {{{
> {% load navigation_tags %}
> }}}
>
> then only one of these will be loaded - and there's no report that there
> is a problem - but if you attempt to use one of the filters / tags from
> one of the libraries that's not the loaded one, it throws a generic
> template syntax error saying it's an invalid tag / filter.
>
> == Proposed solution:
>
> Add a new 'check' to the django checks that warns the user if there are
> multiple templatetag libraries with the same name.
>
> see PR:
>
> https://github.com/django/django/pull/14735

New description:

 If a project has mulitple apps with templatetags with the same module
 name, django will load each of them, but drop all but the last one, and
 not inform the user at all, making it quite hard to diagnose.

 For example, if you have:

 - blog/templatetags/navigation_tags.py
 - news/templatetags/navigation_tags.py
 - pages/templatetags/navigation_tags.py

 then try to use them in a template:

 {{{
 {% load navigation_tags %}
 }}}

 then only one of these will be loaded - and there's no report that there
 is a problem - but if you attempt to use one of the filters / tags from
 one of the libraries that's not the loaded one, it throws a generic
 template syntax error saying it's an invalid tag / filter.

 == Proposed solution:

 Add a new 'check' to the django checks that warns the user if there are
 multiple templatetag libraries with the same name.

 see PR:

 https://github.com/django/django/pull/14735

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32987#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.60f0260257cf66dd21e5b4afdcda6c37%40djangoproject.com.

Reply via email to