“|”是什么符号意味着Django模板? [英] What does "|" sign mean in a Django template?

查看:91
本文介绍了“|”是什么符号意味着Django模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常看到这样的东西:
something.property | escape


某些是一个对象,属性是字符串属性。 escape - 我不知道:)


这是什么意思?而且它使用的是什么最小的python版本?






编辑:问题被问错误地说,Python是什么意思,所以按位或答案是正确的,但不相干,请不要拒绝他们

解决方案

obj.property | escape是应用模板中的转义过滤器,这将HTML转义该属性的字符串表示。


I often see something like that: something.property|escape


something is an object, property is it's string property. escape - i don't know :)
What does this mean? And what min python version it is used in?


EDIT: The question was asked wrongly, it said "What does | mean in Python", so the bitwise or answers are correct, but irrelevant, please do not downvote them

解决方案

obj.property|escape is the way to apply the escape filter in a template, which will HTML escape the string representation of that property.

这篇关于“|”是什么符号意味着Django模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆