1
Vote

Django template IntelliSense doesn't understand simple_tag

description

If you register a tag like this:
# mytags.py
import datetime
from django import template

register = template.Library()

@register.simple_tag
def my_current_time(format_string):
    return datetime.datetime.now().strftime(format_string)
Then use it:
# details.html
{% load mytags %}
{% <check this completion list
It doesn't show up in IntelliSense in the template editor. If you replace simple_tag with tag or assignment_tag, it shows up in completions as expected.

Note: When testing this, it's best to close/reopen the solution after changing the tag code, in order to avoid false positives. I found that if you make it tag or assignment_tag then change it to simple_tag without reloading, it will still show up in completions. But it won't after you reload the solution.

https://docs.djangoproject.com/en/dev/howto/custom-template-tags/

comments