Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

Ckeditor is not working fine in simple blog in models.py django

my model.py

from django.contrib.auth.models import User
from ckeditor.fields import RichTextField #(this field imported)

# Create your models here.
class Blog_post(models.Model):
    title = models.CharField(max_length=200)
    body = models.RichTextField(blank=True) #(this field in body is not defined)
    author = models.ForeignKey(User,on_delete=models.CASCADE)

and CKEditor is installed I followed a tutorial same as but in my case whenever I enter make migration it says the name RichTextField is not defined and I don't know how to fix it any kind of help will be apriciated

question from:https://stackoverflow.com/questions/65845569/ckeditor-is-not-working-fine-in-simple-blog-in-models-py-django

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I already fixed it I was using models.RichTextField() error is throw because RichTextField is not defined in models you should only use tex=RichTextField() it was a typo – baibars313 just now


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...