How do I install django-ckeditor?
In Stack Overflow there's two questions about this editor, and nobody answers!!!
So I'm asking how to install this Django package to my project?? I've followed these steps already, have no errors, nothing, and still the form stays the same. Why??
Edit: heres model
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
from ckeditor.fields import RichTextField
class Newsletter(models.Model):
title = models.CharField(
_(u'Title'),
max_length=200,
help_text=_(u'Newsletter title'),
)
body = RichTextField()
date = models.DateField(
_(u'Date'),
help_text=_(u'Set date when this newsletter should be send')
)
class Meta:
ordering = ['title',]
forms.py
from models import Newsletter, Mail
class NewsletterForm(forms.ModelForm):
class Meta:
model = Newsletter
view:
from newsletter.models import Newsletter开发者_运维问答, Mail
from newsletter.forms import NewsletterForm, MailForm
def newsletters_add(request):
form = NewsletterForm()
tpl = "form_newsletter.html"
return render_to_response(tpl, RequestContext(request, {
'form': form,
}))
All form outputed succesfully with {{ form }} tag
settings.py (of the project)
CKEDITOR_MEDIA_PREFIX = "/media/ckeditor/"
CKEDITOR_UPLOAD_PATH = "/www/vhosts/sender/media/newsletter/uploads/"
CKEDITOR_UPLOAD_PREFIX = "http://******/media/newsletter/uploads/"
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Basic',
},
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'django.contrib.admin',
#'tagging',
'debug_toolbar',
'ckeditor',
'mailer',
'newsletter'
)
The media needed to display the widget correctly should be stored in the form's media
object. You can output the tag for needed js in your template with {{ form.media }}
. The admin should do this automatically, while in your custom views you have to do it yourself... See the django documentation on form media for more information!
ok sorry i was an idiot. in documentation there's no words about including JS manually somehow! so just include it
<script src="http://****/media/ckeditor/ckeditor/ckeditor.js"></script>
Developers are blind in there or something?
精彩评论