v0.3.1紧急修复sitemap导致的makemigrations错误

This commit is contained in:
yangjian 2020-03-10 20:49:30 +08:00
parent 0a02af73fe
commit 743eef5114
10 changed files with 67 additions and 27 deletions

View File

@ -1,5 +1,12 @@
## 版本更新记录
### v0.3.1 2020-03-10
- 紧急修复sitemap导致的makemigrations错误
- 修改文集下载导出模型外键字段类型;
- 调整文集和文档的URL结构
- 更新依赖库文件;
### v0.3.0 2020-03-07
- 优化MD文件导出逻辑修复文档中本地资源不存在引发异常的问题

View File

@ -25,7 +25,7 @@ SECRET_KEY = '5&71mt9@^58zdg*_!t(x6g14q*@84d%ptr%%s6e0l50zs0we3d'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
VERSIONS = '0.3.0'
VERSIONS = '0.3.1'
ALLOWED_HOSTS = ['*']

View File

@ -18,9 +18,9 @@ from django.urls import path,include,re_path
from django.views.static import serve
from django.conf import settings
from django.contrib.sitemaps import views
from app_doc.sitemaps import all_sitemaps
from app_doc.sitemaps import SitemapAll
sitemaps = all_sitemaps()
sitemaps = SitemapAll()
urlpatterns = [
path('admin/', admin.site.urls),

View File

@ -1,4 +1,4 @@
# MrDoc - 一个简单的文档写作应用
# MrDoc - 记录文档,汇聚思想,一个简单的文档记录和阅读应用
**PC端文档阅读界面**
@ -6,9 +6,16 @@
## 介绍
州的先生zmister.com自用并完全开源、基于Python编写的文档写作系统。
州的先生(https://zmister.com自用并完全开源、基于Python编写的文档写作系统。
当前版本为:**v0.3.0**,版本发布时间为**2020-03-07**,更新记录详见:[CHANGES.md](./CHANGES.md)
当前版本为:**v0.3.1**,版本发布时间为**2020-03-10**,此版本主要更新了如下内容:
- 紧急修复sitemap导致的makemigrations错误
- 修改文集下载导出模型外键字段类型;
- 调整文集和文档的URL结构
- 更新依赖库文件;
完整更新记录详见:[CHANGES.md](./CHANGES.md)
MrDoc拥有以下特点

View File

@ -0,0 +1,19 @@
# Generated by Django 2.1 on 2020-03-10 20:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app_doc', '0009_projectreport'),
]
operations = [
migrations.AlterField(
model_name='projectreport',
name='project',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='app_doc.Project'),
),
]

View File

@ -74,7 +74,7 @@ class DocTemp(models.Model):
# 文集导出模型
class ProjectReport(models.Model):
project = models.ForeignKey(Project,unique=True,on_delete=models.CASCADE)
project = models.OneToOneField(Project,unique=True,on_delete=models.CASCADE)
# 允许导出默认为0-允许1-不允许
allow_epub = models.IntegerField(default=0,verbose_name="前台导出EPUB")

View File

@ -41,18 +41,27 @@ class DocSitemap(Sitemap):
def lastmod(self,obj):
return obj.modify_time
def all_sitemaps():
all_sitemap = {}
all_sitemap['home'] = HomeSitemap()
all_project = ProjectSitemap()
# print("所有文集:",all_project.items())
for project in all_project.items():
# for project in Project.objects.filter(role=0):
info_dict = {
'queryset': Doc.objects.filter(status=1,top_doc=project.id),
}
# sitemap = GenericSitemap(info_dict,priority=0.6)
sitemap = DocSitemap(pro=project.id)
all_sitemap[str(project.id)] = sitemap
# print(all_sitemaps)
return all_sitemap
class SitemapAll():
def __init__(self):
self.sitemaps = {}
def __iter__(self):
self._generate_sitemaps_dict()
return self.sitemaps.__iter__()
def __getitem__(self, key):
self._generate_sitemaps_dict()
return self.sitemaps[key]
def items(self):
self._generate_sitemaps_dict()
return self.sitemaps.items()
def _generate_sitemaps_dict(self):
if self.sitemaps:
return
for project in Project.objects.filter(role=0):
sitemap = DocSitemap(pro=project.id)
self.sitemaps[str(project.id)] = sitemap
self.sitemaps['home'] = HomeSitemap()

View File

@ -4,7 +4,7 @@ from app_doc import views,util_upload_img
urlpatterns = [
path('',views.project_list,name='pro_list'),# 文档首页
#################文集相关
path('project/<int:pro_id>/', views.project_index, name='pro_index'), # 文集浏览页
path('project-<int:pro_id>/', views.project_index, name='pro_index'), # 文集浏览页
path('create_project/', views.create_project, name='create_project'), # 新建文集
path('get_pro_doc/', views.get_pro_doc, name="get_pro_doc"), # 获取某个文集的下级文档
path('modify_pro/',views.modify_project,name='modify_project'), # 修改文集
@ -16,7 +16,7 @@ urlpatterns = [
path('modify_pro_download/<int:pro_id>/', views.modify_project_download, name="modify_pro_download"), # 修改文集前台下载权限
path('check_viewcode/',views.check_viewcode,name='check_viewcode'),# 文集访问码验证
#################文档相关
path('project/<int:pro_id>/<int:doc_id>/', views.doc, name='doc'), # 文档浏览页
path('project-<int:pro_id>/doc-<int:doc_id>/', views.doc, name='doc'), # 文档浏览页
path('create_doc/', views.create_doc, name="create_doc"), # 新建文档
path('modify_doc/<int:doc_id>/', views.modify_doc, name="modify_doc"), # 修改文档
path('del_doc/',views.del_doc,name="del_doc"), # 删除文档

View File

@ -1,7 +1,5 @@
beautifulsoup4==4.8.2
Django==2.2.3
Pillow==6.1.0
pkg-resources==0.0.0
pytz==2019.1
soupsieve==2.0
sqlparse==0.3.0

View File

@ -12,7 +12,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>MrDoc - 一个简单的文档写作系统</title>
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
<link href="{% static 'mrdoc.css' %}" rel="stylesheet">
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
<link rel="icon" href="{% static 'favicon_16.png' %}"/>
</head>
<body class="layui-container">