Ckeditor在admin中显示了一个richtextfield?

时间:2016-10-03 18:20:42

标签: python django ckeditor

我想在django admin中添加一个html富文本。我按照说明去了发球台。但由于某种原因,它没有恢复?我错过了什么?

这是settings.py -

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'skoolprofile',
    'django.contrib.sites',
    'disqus',
    'django.contrib.sitemaps',
    'easy_maps',
    'hitcount',
    'accounts',
    'localflavor',
    'crispy_forms',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
    'autoslug',
    'storages',
    'compressor',
    'activities',
    'tastypie',
    'ckeditor',
]

AWS_QUERYSTRING_AUTH = False
CKEDITOR_CONFIGS = {
    'awesome_ckeditor': {
        'toolbar': 'Basic',
    },
}
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'

这里是models.py -

from ckeditor.fields import RichTextField

class adalerts(models.Model):
    headline = models.CharField(max_length =200, null =True, blank=True) 
    description =  RichTextField(config_name='awesome_ckeditor', null = True, blank=True)

    schoolid = models.CharField(max_length = 100, null = True, blank=True)
    schoolname = models.CharField(max_length = 100, null = True, blank=True)
    city = models.CharField(max_length = 100, null = True, blank=True)
    location = models.CharField(max_length = 100, null = True, blank=True)
    timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
    def __str__(self):              # __unicode__ on Python 2
         return "%s - %s - %s" % (unicode(self.schoolid) , unicode(self.city), (unicode(self.schoolname)))

这是admin -

admin.site.register(adalerts)

我做了python manage.py collectstatic。我确实做了迁移和迁移。但是对于字段richtextField"描述"而没有运气。我仍然看到一个文本域。

1 个答案:

答案 0 :(得分:0)

您能否在控制台上检查静态文件是否正确加载? 也尝试运行一次 collectstatic