v0.3.2紧急修复访问码输入正确后404的错误

This commit is contained in:
yangjian 2020-03-12 20:37:58 +08:00
parent 743eef5114
commit 443917eb12
4 changed files with 11 additions and 12 deletions

View File

@ -1,5 +1,10 @@
## 版本更新记录
### v0.3.2 2020-03-12
- 修复访问码跳转文档404的错误
### v0.3.1 2020-03-10
- 紧急修复sitemap导致的makemigrations错误

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.1'
VERSIONS = '0.3.2'
ALLOWED_HOSTS = ['*']

View File

@ -8,12 +8,9 @@
州的先生https://zmister.com自用并完全开源、基于Python编写的文档写作系统。
当前版本为:**v0.3.1**,版本发布时间为**2020-03-10**,此版本主要更新了如下内容:
当前版本为:**v0.3.2**,版本发布时间为**2020-03-12**,此版本主要更新了如下内容:
- 紧急修复sitemap导致的makemigrations错误
- 修改文集下载导出模型外键字段类型;
- 调整文集和文档的URL结构
- 更新依赖库文件;
- 紧急修复访问码跳转文档404的错误
完整更新记录详见:[CHANGES.md](./CHANGES.md)

View File

@ -1,3 +1,4 @@
# coding:utf-8
from django.shortcuts import render,redirect
from django.http.response import JsonResponse,Http404,HttpResponseNotAllowed,HttpResponse
from django.http import HttpResponseForbidden
@ -170,7 +171,7 @@ def modify_project_role(request,pro_id):
def check_viewcode(request):
try:
if request.method == 'GET':
project_id = request.GET.get('to','').split("/")[2]
project_id = request.GET.get('to','').split("/")[1].split('-')[1]
project = Project.objects.get(id=int(project_id))
return render(request,'app_doc/check_viewcode.html',locals())
else:
@ -178,13 +179,12 @@ def check_viewcode(request):
project_id = request.POST.get('project_id','')
project = Project.objects.get(id=int(project_id))
if project.role == 3 and project.role_value == viewcode:
obj = redirect("/project/{}/".format(project_id))
obj = redirect("pro_index",pro_id=project_id)
obj.set_cookie('viewcode-{}'.format(project_id),viewcode)
return obj
else:
errormsg = "访问码错误"
return render(request, 'app_doc/check_viewcode.html', locals())
except Exception as e:
print(repr(e))
return render(request,'404.html')
@ -271,9 +271,6 @@ def modify_project_download(request,pro_id):
return render(request,'app_doc/manage_project_download.html',locals())
# 文档浏览页页
@require_http_methods(['GET'])
def doc(request,pro_id,doc_id):