Calling Python function in Django template

后端 未结 4 2019
一向
一向 2021-02-09 12:52

Inside a django template I\'m trying to call the split function on one of the template variables and then get the last element, so I did something like this:

{{          


        
4条回答
  •  醉酒成梦
    2021-02-09 13:36

    Yes, as others have said, you shouldn't really be doing it in the templates.

    But if you want to, then you need to define a filter and load it in the template and use it.

提交回复
热议问题