Django-Summernote 编辑器未在管理员中显示
Django-Summernote editor not showing in Admin
我有一个用于 post 写作的 Django 应用程序。我已经将 django-summernote 集成到应用程序中,但我遇到了一个问题,即 django summernote 小部件未显示在管理面板中。它在我的模板中运行良好且流畅,但未显示在管理面板中。请帮助我。
settings.py
INSTALLED_APPS += ('django_summernote', )
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
X_FRAME_OPTIONS = 'SAMEORIGIN'
SUMMERNOTE_CONFIG = {
'iframe': False,
"jquery": "summernoteJQuery",
'summernote': {
'width': '100%'
}
}
SUMMERNOTE_THEME = 'bs3'
admin.py
from django.contrib import admin
from .models import Post, Comment
from django_summernote.admin import SummernoteModelAdmin
class PostAdmin(SummernoteModelAdmin):
summernote_fields = ('text',)
admin.site.register(Post,PostAdmin)
admin.site.register(Comment)
urls.py
from django.urls import include
# ...
urlpatterns = [
...
path('summernote/', include('django_summernote.urls')),
...
]
...
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
screenshotAdminPanel
After 'Iframe = True'
如果您在 Django 管理面板中不使用 BootStrap 或外部 CSS 框架,则必须设置 'iframe': True,
否则,您必须将其设置为 False
检查这个文档。 https://github.com/summernote/django-summernote
使用 SummernoteWidget - iframe 模式,默认
'iframe': True,
# Or, you can set it to `False` to use SummernoteInplaceWidget by default - no iframe mode
# In this case, you have to load Bootstrap/jQuery sources and dependencies manually.
# Use this when you're already using Bootstrap/jQuery based themes.
'iframe': False,
我有一个用于 post 写作的 Django 应用程序。我已经将 django-summernote 集成到应用程序中,但我遇到了一个问题,即 django summernote 小部件未显示在管理面板中。它在我的模板中运行良好且流畅,但未显示在管理面板中。请帮助我。
settings.py
INSTALLED_APPS += ('django_summernote', )
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
X_FRAME_OPTIONS = 'SAMEORIGIN'
SUMMERNOTE_CONFIG = {
'iframe': False,
"jquery": "summernoteJQuery",
'summernote': {
'width': '100%'
}
}
SUMMERNOTE_THEME = 'bs3'
admin.py
from django.contrib import admin
from .models import Post, Comment
from django_summernote.admin import SummernoteModelAdmin
class PostAdmin(SummernoteModelAdmin):
summernote_fields = ('text',)
admin.site.register(Post,PostAdmin)
admin.site.register(Comment)
urls.py
from django.urls import include
# ...
urlpatterns = [
...
path('summernote/', include('django_summernote.urls')),
...
]
...
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
screenshotAdminPanel
After 'Iframe = True'
如果您在 Django 管理面板中不使用 BootStrap 或外部 CSS 框架,则必须设置 'iframe': True,
否则,您必须将其设置为 False
检查这个文档。 https://github.com/summernote/django-summernote
使用 SummernoteWidget - iframe 模式,默认
'iframe': True,
# Or, you can set it to `False` to use SummernoteInplaceWidget by default - no iframe mode
# In this case, you have to load Bootstrap/jQuery sources and dependencies manually.
# Use this when you're already using Bootstrap/jQuery based themes.
'iframe': False,