J
J
Juvel19882021-02-11 01:54:17
Django
Juvel1988, 2021-02-11 01:54:17

Why does CKEditor display information incorrectly?

I am writing a Django project using CKEditor. In the editor itself, I write the title and text of the article, attach pictures. It looks like this:
602462856dabc939278627.png

However, when the page loads, I see the following:

602462bf9dee5496383788.png

What is my problem?

models.py

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from ckeditor_uploader.fields import RichTextUploadingField

class News(models.Model):
    title = models.CharField(max_length=250)
    slug = models.SlugField(max_length=50,unique=True)
    author = models.ForeignKey(User,on_delete=models.CASCADE,
    related_name='news_posts', null=True, blank=True)
    anons = models.CharField(max_length=350)
    body = RichTextUploadingField(null=True, blank=True)
    date_added = models.DateTimeField(auto_now_add=True)
    # Возврат понятного отображения заголовка в панель администрирования
    def __str__(self):
        return self.title
    class Meta:
        verbose_name = u"Новость"
        verbose_name_plural = u"Новости"

urls.py

path('ckeditor/', include('ckeditor_uploader.urls')),


settings.py

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = '/media/'
CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
CKEDITOR_CONFIGS = {

    'default': {

     'toolbar': 'None'

    },

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2021-02-11
@Juvel1988

Show the template, although most likely you didn’t manage to google the safe filter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question