Answer the question
In order to leave comments, you need to log in
Django-ckeditor how to save text entered in browser?
Hi all! help me cope with the task there is a blog application on the page for adding an article the ckeditor widget is displayed I enter the text and alas it is not saved in the database, only the name is saved and if I do not use the widget but just a textarea then the text is perfectly saved in the database
INSTALLED_APPS = (
'grappelli',
.....
'ckeditor',
'ckeditor_uploader',
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
CKEDITOR_RESTRICT_BY_USER = True # поьзователь видит только свои файлы
CKEDITOR_IMAGE_BACKEND = "pillow"
# собственно вьюшка орабатывающая сохранение в базу данных!
def post_new(request):
if request.user.is_authenticated():
if request.method == 'POST':
form = PostForms(request.POST)
if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.save()
return redirect('post:post_detail', pk=post.pk)
else:
form = PostForms
return render(request, 'post_edit.html', {'form': form, 'username': auth.get_user(request).username})
else:
return render_to_response('post_new.html')
Answer the question
In order to leave comments, you need to log in
Here is an example , look at the source code, maybe it will help you with something.
Thank you all for your understanding, in the end I replaced the use in the widget form with a simple use of the field from the model and everything worked again thanks to everyone!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question