Compare commits
No commits in common. "6cfd3334d038973b13aea4d54cf75876e4e0ad78" and "f82a071a46602ddb8eafe0d701deab483450b4db" have entirely different histories.
6cfd3334d0
...
f82a071a46
Binary file not shown.
Binary file not shown.
@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
@ -42,7 +42,6 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'mdeditor',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@ -137,35 +136,4 @@ SIMPLEUI_CONFIG = {
|
||||
}],
|
||||
}
|
||||
|
||||
Echo_Z_version = "1.2.3"
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
# 设置前缀
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
MDEDITOR_CONFIGS = {
|
||||
'default': {
|
||||
'width': 690, # Custom edit box width
|
||||
'heigth': 500, # Custom edit box height
|
||||
'toolbar': ["undo", "redo", "|",
|
||||
"bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|",
|
||||
"h1", "h2", "h3", "h5", "h6", "|",
|
||||
"list-ul", "list-ol", "hr", "|",
|
||||
"link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime"
|
||||
"emoji",
|
||||
"html-entities", "pagebreak", "goto-line", "|",
|
||||
"help", "info",
|
||||
"||", "preview", "watch", "fullscreen"], # custom edit box toolbar
|
||||
'upload_image_formats': ["jpg", "jpeg", "gif", "png", "bmp", "webp"], # image upload format type
|
||||
'image_floder': 'editor', # image save the folder name
|
||||
'theme': 'default', # edit box theme, dark / default
|
||||
'preview_theme': 'default', # Preview area theme, dark / default
|
||||
'editor_theme': 'default', # edit area theme, pastel-on-dark / default
|
||||
'toolbar_autofixed': True, # Whether the toolbar capitals
|
||||
'search_replace': True, # Whether to open the search for replacement
|
||||
'emoji': True, # whether to open the expression function
|
||||
'tex': True, # whether to open the tex chart function
|
||||
'flow_chart': True, # whether to open the flow chart function
|
||||
'sequence': True # Whether to open the sequence diagram function
|
||||
}
|
||||
}
|
||||
Echo_Z_version = "1.2.3"
|
@ -1,15 +1,11 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import path,include
|
||||
from django.urls import re_path
|
||||
from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
|
||||
admin.site.site_title = 'Echo-Z'
|
||||
admin.site.site_header = '后台管理'
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/', include('api.urls')),
|
||||
path('', include('home.urls')),
|
||||
re_path(r'mdeditor/', include('mdeditor.urls')),
|
||||
]
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
@ -59,13 +59,8 @@ python manage.py runserver 9999
|
||||
2.站点设置
|
||||
|
||||
###### 1.2.3
|
||||
2025年6月24日
|
||||
2025年6月234日
|
||||
新增
|
||||
1.分类管理
|
||||
2.文章分类的设置
|
||||
3.分类文章的列表
|
||||
|
||||
###### 1.2.4
|
||||
2025年7月1日
|
||||
修改
|
||||
1.后台文章编辑使用mdeditor
|
||||
3.分类文章的列表
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,14 +1,13 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from home.models import *
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(Articles)
|
||||
class DepartmentAdmin(admin.ModelAdmin):
|
||||
|
||||
# 要显示的字段
|
||||
list_display = ('title', 'abstract', 'created','stat')
|
||||
search_fields = ('title','abstract',)
|
||||
exclude = ('content',)
|
||||
# 不可编辑字段
|
||||
readonly_fields = ('stat','read')
|
||||
# 分页显示,一页的数量
|
||||
|
25
home/migrations/0001_initial.py
Normal file
25
home/migrations/0001_initial.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-19 03:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='articles',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=100, verbose_name='文章标题')),
|
||||
('content', models.TextField(verbose_name='文章内容')),
|
||||
('abstract', models.TextField(verbose_name='文章摘要')),
|
||||
('created', models.DateTimeField(auto_now_add=True, verbose_name='发布时间')),
|
||||
('stat', models.IntegerField(default=False, verbose_name='点赞数量')),
|
||||
],
|
||||
),
|
||||
]
|
18
home/migrations/0002_alter_articles_created.py
Normal file
18
home/migrations/0002_alter_articles_created.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-19 03:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='articles',
|
||||
name='created',
|
||||
field=models.DateTimeField(verbose_name='发布时间'),
|
||||
),
|
||||
]
|
22
home/migrations/0003_alter_articles_options_articles_read.py
Normal file
22
home/migrations/0003_alter_articles_options_articles_read.py
Normal file
@ -0,0 +1,22 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-19 07:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0002_alter_articles_created'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='articles',
|
||||
options={'verbose_name': '文章', 'verbose_name_plural': '文章管理'},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='articles',
|
||||
name='read',
|
||||
field=models.IntegerField(default=0, verbose_name='阅读数量'),
|
||||
),
|
||||
]
|
18
home/migrations/0004_articles_author.py
Normal file
18
home/migrations/0004_articles_author.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-19 08:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0003_alter_articles_options_articles_read'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='articles',
|
||||
name='author',
|
||||
field=models.TextField(default='admin', verbose_name='文章作者'),
|
||||
),
|
||||
]
|
25
home/migrations/0005_articleslike.py
Normal file
25
home/migrations/0005_articleslike.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-22 18:14
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0004_articles_author'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ArticlesLike',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('articles_id', models.IntegerField(default=0, verbose_name='文章id')),
|
||||
('uuid', models.CharField(max_length=100, verbose_name='点赞用户标识')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '点赞',
|
||||
'verbose_name_plural': '点赞管理',
|
||||
},
|
||||
),
|
||||
]
|
@ -0,0 +1,21 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-23 03:17
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0005_articleslike'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelTable(
|
||||
name='articles',
|
||||
table='Articles',
|
||||
),
|
||||
migrations.AlterModelTable(
|
||||
name='articleslike',
|
||||
table='ArticlesLike',
|
||||
),
|
||||
]
|
31
home/migrations/0007_articletag_articles_tag_id.py
Normal file
31
home/migrations/0007_articletag_articles_tag_id.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 4.2.23 on 2025-06-24 01:37
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0006_alter_articles_table_alter_articleslike_table'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ArticleTag',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('tag', models.CharField(max_length=120)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '标签',
|
||||
'verbose_name_plural': '标签管理',
|
||||
'db_table': 'ArticleTag',
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='articles',
|
||||
name='tag_id',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='home.articletag', verbose_name='文章标签'),
|
||||
),
|
||||
]
|
0
home/migrations/__init__.py
Normal file
0
home/migrations/__init__.py
Normal file
BIN
home/migrations/__pycache__/0001_initial.cpython-39.pyc
Normal file
BIN
home/migrations/__pycache__/0001_initial.cpython-39.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
home/migrations/__pycache__/0004_articles_author.cpython-39.pyc
Normal file
BIN
home/migrations/__pycache__/0004_articles_author.cpython-39.pyc
Normal file
Binary file not shown.
BIN
home/migrations/__pycache__/0005_articleslike.cpython-39.pyc
Normal file
BIN
home/migrations/__pycache__/0005_articleslike.cpython-39.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
home/migrations/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
home/migrations/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
@ -1,6 +1,4 @@
|
||||
from django.db import models
|
||||
import markdown
|
||||
from mdeditor.fields import MDTextField
|
||||
|
||||
# Create your models here.
|
||||
|
||||
@ -16,8 +14,7 @@ class ArticleTag(models.Model):
|
||||
|
||||
class Articles(models.Model):
|
||||
title = models.CharField(max_length=100,verbose_name="文章标题")
|
||||
content_raw = MDTextField(verbose_name='文章内容', default='', config_name='default')
|
||||
content = models.TextField(verbose_name='呈现内容', null=True, blank=True, default='')
|
||||
content = models.TextField(verbose_name="文章内容")
|
||||
abstract = models.TextField(verbose_name="文章摘要")
|
||||
author = models.TextField(default="admin", verbose_name="文章作者")
|
||||
created = models.DateTimeField(verbose_name="发布时间")
|
||||
@ -25,14 +22,6 @@ class Articles(models.Model):
|
||||
read = models.IntegerField(default=0,verbose_name="阅读数量")
|
||||
tag_id = models.ForeignKey(ArticleTag, on_delete=models.SET_NULL, null=True, blank=True, verbose_name="文章标签")
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
# 将Markdown格式 转为html,页面上显示
|
||||
self.content = markdown.markdown(self.content_raw, extensions=[
|
||||
'markdown.extensions.extra',
|
||||
'markdown.extensions.codehilite',
|
||||
'markdown.extensions.toc',
|
||||
])
|
||||
super(Articles, self).save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "文章"
|
||||
|
@ -13,4 +13,3 @@ sqlparse==0.5.3
|
||||
tablib==3.8.0
|
||||
typing_extensions==4.14.0
|
||||
zipp==3.23.0
|
||||
mdeditor
|
||||
|
Loading…
x
Reference in New Issue
Block a user