私はfrog WYSIWYGを私の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-editorを使用すると、管理ページのエディタはポストページで動作しません。 https://stackoverflow.com/questions/34941170/using-django-froala-editor-the-editor-works-in-admin-page-wont-work-in-post-pa) – a7me3D