4
我試圖爲我的django項目使用CKEeditor,但是當我添加一個使用此編輯器的新項目時,我看到了html代碼。CKEditor向我展示了html代碼
我用這樣的:
我的模型:
class Article(models.Model):
title = models.CharField(max_length=100, unique=True)
slug = models.SlugField(max_length=100, unique=True)
category = models.ForeignKey('Category')
content = RichTextField()
date = models.DateTimeField(auto_now = True)
online = models.BooleanField()
我的網址:url(r'^ckeditor/', include('ckeditor.urls')),
我的觀點:
def view_post(request, slug):
return render_to_response('website/view_post.html',
{
'post': get_object_or_404(Article, slug=slug),
},
context_instance = RequestContext(request)
)
和我的模板:
<div id="post">
<h1> {{ post.title }}</h1>
<p>{{post.content}}</p>
<i>{{post.date}}</i>
</div>
請幫忙。
感謝您的回答。
非常感謝!有用 ! –
你爲我節省了一天 –
在這裏謝謝你。非常好的修復。 – newguy