我想要使用froala所見即所得在我的Django項目我安裝並準備好了,因爲它是提到在文檔 但仍顯示爲文本字段 因此任何解決方案的內容領域? ?froala Django的模板不工作
我的代碼 forms.py
from django import forms
from .models import BlogPost
from froala_editor.widgets import FroalaEditor
class PostForm(forms.ModelForm):
content = forms.CharField(widget=FroalaEditor())
class Meta:
model = BlogPost
fields = ('title','body','thumb','tags')
模板
{% load static %}
{% load crispy_forms_tags %}
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="/static/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/static/font-awesome/css/font-awesome.css">
<link href="{{STATIC_URL}}froala_editor/css/font-awesome.min.css" type="text/css" media="all" rel="stylesheet" />
<link href="{{STATIC_URL}}froala_editor/css/froala_editor.min.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="{{STATIC_URL}}froala_editor/js/froala_editor.min.js"></script
</head>
<body>
<form method="POST" class="padding" enctype="multipart/form-data">
{% csrf_token %}
{{ editor|crispy }}
</form>
</body>
</html>
注意
editor = PostForm(request.POST, request.FILES)
在我的意見
,我有麻煩
jQuery的餅乾 錯誤:
Uncaught ReferenceError: getCookie is not defined
at HTMLDocument.<anonymous> ((index):72)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
at HTMLDocument.K (jquery.min.js:2)
感謝@Awin這就是答案: [使用django-froala編輯器,編輯器在管理頁面工作將不會在post頁面工作?未捕獲TypeError:$(...).froalaEditor不是函數]( https://stackoverflow.com/questions/34941170/using-django-froala-editor-the-editor-works-in-admin-page-wont-work-in-post-pa) – a7me3D