开发者

How to compare 3 objects in a django template

开发者 https://www.devze.com 2023-04-13 05:12 出处:网络
My string of elementary django questions continues. If I ha开发者_运维问答ve three string variables and want to test that one of them, \"fullname,\" is equivalent to two others concatenated, \"first\

My string of elementary django questions continues.

If I ha开发者_运维问答ve three string variables and want to test that one of them, "fullname," is equivalent to two others concatenated, "first" and a space and then "last," how would I go about doing so in the context of a django template?


You could write a custom template tag, that might offer you something like this:

{% test_name_equality "Dagobert Duck" "Dagobert" "Duck" %}

in the template you can use very normal python string handling.

0

精彩评论

暂无评论...
验证码 换一张
取 消