mdeditor有大问题

This commit is contained in:
跨越晨昏 2024-09-22 20:22:24 +08:00
parent 232e3624cb
commit e6cf5995b2
7 changed files with 15 additions and 5 deletions

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<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="sourceFolder" forTests="false" />
</component>

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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>

View File

@ -8,6 +8,8 @@ from django.http import HttpResponseRedirect
from django.urls import include, path, re_path
from django.contrib.contenttypes import views as contenttype_views
from django.contrib.auth.views import redirect_to_login
class MyAdminSite(admin.AdminSite):
def admin_view(self, view, cacheable=False):
def inner(request, *args, **kwargs):

View File

@ -1,5 +1,3 @@
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -30,6 +28,7 @@ INSTALLED_APPS = [
'interflow',
'ckeditor',
'ckeditor_uploader',
'mdeditor',
]
MIDDLEWARE = [

View File

@ -15,5 +15,6 @@ urlpatterns = [
re_path('static/(?P<path>.*)', serve, {'document_root': settings.STATIC_ROOT}, name='static'),
# 设置编辑器的路由信息
path('ckeditor/', include('ckeditor_uploader.urls')),
path('mdeditor/', include('mdeditor.urls'))
]

View File

@ -2,6 +2,7 @@ from django.db import models
from django.utils import timezone
from account.models import MyUser
from ckeditor_uploader.fields import RichTextUploadingField
from mdeditor.fields import MDTextField
class ArticleTag(models.Model):
@ -20,8 +21,8 @@ class ArticleTag(models.Model):
class ArticleInfo(models.Model):
author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户')
title = models.CharField('标题', max_length=200)
content = RichTextUploadingField(verbose_name='内容')
rendered = RichTextUploadingField(verbose_name='最终内容', default='<p>默认内容</p>')
content = MDTextField(verbose_name='内容')
rendered = MDTextField(verbose_name='最终内容', default='<p>默认内容</p>')
articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/')
reading = models.IntegerField('阅读量', default=0)
liking = models.IntegerField('点赞量', default=0)

2
requirement.txt Normal file
View File

@ -0,0 +1,2 @@
django>=5.1.1
django-mdeditor>=0.1.20