简体   繁体   中英

Is it possible to change django's template tag {{?

假设我已经有一个基于angularjs的大型代码,模板标签为{{ -是否可以将django的模板标签更改为{[{

Update

Perhaps dynamically patch it

import re
import django.template.base
django.template.base.VARIABLE_TAG_END = '}]}'
django.template.base.VARIABLE_TAG_START = '{[{'
django.template.base.tag_re = re.compile(ur'(\{\%.*?\%\}|\{\[\{.*?\}\]\}|\{\#.*?\#\})')
reload(django.template)

Put this in __init__.py of your any apps and see if it works.


No simple way currently, they are hardcoded :

VARIABLE_TAG_START = '{{'
VARIABLE_TAG_END = '}}'

Anyway, you could patch your local installation or forked version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM