We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Django版本3.2.13 xadmin版本2.0.1 django-ckeditor版本6.3.2 当将模型类字段类型改成RichTextField时xadmin能够显示富文本编辑 当将模型类字段类型改成RichTextUploadingField时xadmin则无法显示富文本编辑
The text was updated successfully, but these errors were encountered:
确保您已正确安装了django-ckeditor库,并且在INSTALLED_APPS设置中添加了ckeditor。 确保您在模型类中正确导入了所需的字段类型和相关模块。例如,您的模型类应该包含以下导入语句:
from ckeditor.fields import RichTextField, RichTextUploadingField 针对RichTextUploadingField字段类型,您可以尝试进行一些自定义配置,以使其在xadmin中正常显示富文本编辑器。在您的xadmin的ModelAdmin类中,您可以通过重写formfield_for_dbfield方法来指定字段的表单小部件。例如:
from xadmin import views from ckeditor.widgets import CKEditorWidget
class MyModelAdmin(views.CommAdminView): def formfield_for_dbfield(self, db_field, **kwargs): if isinstance(db_field, RichTextUploadingField): kwargs['widget'] = CKEditorWidget() return super().formfield_for_dbfield(db_field, **kwargs) 这将使用CKEditorWidget作为RichTextUploadingField字段类型的表单小部件,以便在xadmin中显示富文本编辑器
Sorry, something went wrong.
No branches or pull requests
Django版本3.2.13
xadmin版本2.0.1
django-ckeditor版本6.3.2
当将模型类字段类型改成RichTextField时xadmin能够显示富文本编辑
当将模型类字段类型改成RichTextUploadingField时xadmin则无法显示富文本编辑
The text was updated successfully, but these errors were encountered: