mdeditor有大问题
This commit is contained in:
parent
232e3624cb
commit
e6cf5995b2
@ -1,7 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/SinkDark/static/ckeditor/ckeditor/plugins/codesnippet/lib" />
|
||||||
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||||
|
<component name="PyCharmProfessionalAdvertiser">
|
||||||
|
<option name="shown" value="true" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
@ -8,6 +8,8 @@ from django.http import HttpResponseRedirect
|
|||||||
from django.urls import include, path, re_path
|
from django.urls import include, path, re_path
|
||||||
from django.contrib.contenttypes import views as contenttype_views
|
from django.contrib.contenttypes import views as contenttype_views
|
||||||
from django.contrib.auth.views import redirect_to_login
|
from django.contrib.auth.views import redirect_to_login
|
||||||
|
|
||||||
|
|
||||||
class MyAdminSite(admin.AdminSite):
|
class MyAdminSite(admin.AdminSite):
|
||||||
def admin_view(self, view, cacheable=False):
|
def admin_view(self, view, cacheable=False):
|
||||||
def inner(request, *args, **kwargs):
|
def inner(request, *args, **kwargs):
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
@ -30,6 +28,7 @@ INSTALLED_APPS = [
|
|||||||
'interflow',
|
'interflow',
|
||||||
'ckeditor',
|
'ckeditor',
|
||||||
'ckeditor_uploader',
|
'ckeditor_uploader',
|
||||||
|
'mdeditor',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -15,5 +15,6 @@ urlpatterns = [
|
|||||||
re_path('static/(?P<path>.*)', serve, {'document_root': settings.STATIC_ROOT}, name='static'),
|
re_path('static/(?P<path>.*)', serve, {'document_root': settings.STATIC_ROOT}, name='static'),
|
||||||
# 设置编辑器的路由信息
|
# 设置编辑器的路由信息
|
||||||
path('ckeditor/', include('ckeditor_uploader.urls')),
|
path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||||
|
path('mdeditor/', include('mdeditor.urls'))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ from django.db import models
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from account.models import MyUser
|
from account.models import MyUser
|
||||||
from ckeditor_uploader.fields import RichTextUploadingField
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
|
from mdeditor.fields import MDTextField
|
||||||
|
|
||||||
|
|
||||||
class ArticleTag(models.Model):
|
class ArticleTag(models.Model):
|
||||||
@ -20,8 +21,8 @@ class ArticleTag(models.Model):
|
|||||||
class ArticleInfo(models.Model):
|
class ArticleInfo(models.Model):
|
||||||
author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户')
|
author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户')
|
||||||
title = models.CharField('标题', max_length=200)
|
title = models.CharField('标题', max_length=200)
|
||||||
content = RichTextUploadingField(verbose_name='内容')
|
content = MDTextField(verbose_name='内容')
|
||||||
rendered = RichTextUploadingField(verbose_name='最终内容', default='<p>默认内容</p>')
|
rendered = MDTextField(verbose_name='最终内容', default='<p>默认内容</p>')
|
||||||
articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/')
|
articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/')
|
||||||
reading = models.IntegerField('阅读量', default=0)
|
reading = models.IntegerField('阅读量', default=0)
|
||||||
liking = models.IntegerField('点赞量', default=0)
|
liking = models.IntegerField('点赞量', default=0)
|
||||||
|
2
requirement.txt
Normal file
2
requirement.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
django>=5.1.1
|
||||||
|
django-mdeditor>=0.1.20
|
Loading…
Reference in New Issue
Block a user