我试图在django项目中使用froala WYSIWYG,我安装并准备了文档中提到的所有内容,但是内容字段仍然显示为文本字段,那么有什么解决方案吗?
我的代码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)发布于 2018-03-23 12:50:06
我找到了这个答案,使用django-froala-编辑器,编辑器在管理页面中的工作将不能在post页面中工作。,问题在Jquery中,我在Froala脚本之前替换了主要的Jquery文件
发布于 2017-09-14 23:58:29
https://stackoverflow.com/questions/46226854
复制相似问题