如何在其余api页面中获取ckeditor工具栏?

时间:2019-03-30 19:22:58

标签: django-rest-framework ckeditor

我正在使用django rest框架和django-ckeditor来创建带有描述的表单。我的问题是ckeditor工具栏丢失了,这是正常现象还是我需要添加一些功能使其显示? 在前端,如果要使用vue,是否应该再次将ckeditor添加到vue应用程序中?

models.py

from django.db import models
from . import CustomUser
from ckeditor.fields import RichTextField
class Blog(models.Model):
    user = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
    title = models.CharField(max_length=30, null=False)
    description = RichTextField(blank=True, null=True)

serializers.py

class CreateBlogSerializer(serializers.ModelSerializer):
    user = serializers.HiddenField(
        default=serializers.CurrentUserDefault())

    class Meta:
        model = Blog
        fields = ('user', 'title',
              'description',
              )

views.py

class BlogCreateView(generics.CreateAPIView):
    queryset = Blog.objects.all()
    serializer_class = CreateBlogSerializer
    authentication_classes = (TokenAuthentication,)
    permission_classes = (IsAuthenticated, Authorized_Company_User,)

我不确定是否可行,我在管理页面中找到了工具栏,但在api中却没有。

0 个答案:

没有答案