首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
Django下富文本显示的问题
killpanda
·
killpanda
·
2011-11-22 11:36:14 +08:00
· 4637 次点击
这是一个创建于 4719 天前的主题,其中的信息可能已经有所发展或是发生改变。
我刚学Web开发,自己正在练习一点一点写一个博客程序。我为我的程序添加了TinyMCE,可是显示文章内容出了问题。
在页面里,显示的内容却是这样的:
<p><span style="font-family: 'arial black', 'avant garde'; font-size: medium;">It works!</span></p>
查看页面的代码为:
<h1><p>Hello World</p></h1>
<p><span style="font-family: 'arial black', 'avant garde'; font-size: medium;">It works!</span></p>
我的html模板是这样的:
<h1><p>{{ blog.head }}</p></h1>
{{ blog.body }}
请问如何处理这个问题?
谢谢了!
span
lt
H1
3 条回复
•
1970-01-01 08:00:00 +08:00
1
SErHo
2011-11-22 11:55:38 +08:00
这个是自动转义了,可以用safe过滤器为单独的变量关闭自动转意,如{{ blog.body|safe }} ,详细参考:
http://djangobook.py3k.cn/2.0/chapter09/#cn77
2
killpanda
OP
2011-11-22 12:02:01 +08:00
@
SErHo
感谢!!确实是这个问题!
我才看了前4章,所以遇到了这些弱智的问题,还不会解决,呵呵。
谢谢了
3
loading
2011-11-24 20:21:07 +08:00
学习了!
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
3225 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms ·
UTC 11:20
·
PVG 19:20
·
LAX 04:20
·
JFK 07:20
Developed with
CodeLauncher
♥ Do have faith in what you're doing.