From 2be8159cfd327949194f17aab63edcd1c0ebbeca Mon Sep 17 00:00:00 2001 From: biheng Date: Tue, 22 Dec 2020 14:06:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dpython3=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models.py | 2 +- templates/ipapub/upfile_detail.html | 2 +- urls.py | 4 ++-- views.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/models.py b/models.py index fb5c4cf..0de2d29 100644 --- a/models.py +++ b/models.py @@ -68,7 +68,7 @@ class UpFile(models.Model): upload_to=icon_path) # 大图标 plist = models.FileField(upload_to=ipapub.PACKAGE_DIR) # plist文件 pub = models.FileField(upload_to=ipapub.PACKAGE_DIR) # 发布的文件压缩包集合 - signed = ContentTypeRestrictedFileField(content_types=['application/iphone'], + signed = ContentTypeRestrictedFileField(content_types=['application/iphone', 'application/octet-stream'], max_upload_size=104857600, upload_to=icon_path, blank=True, null=True) # 签名好的文件 status = models.CharField(max_length=10, blank=True) # 状态,uploaded,。。。 diff --git a/templates/ipapub/upfile_detail.html b/templates/ipapub/upfile_detail.html index 6ff05f6..cf33005 100644 --- a/templates/ipapub/upfile_detail.html +++ b/templates/ipapub/upfile_detail.html @@ -8,7 +8,7 @@
安装:
- {{ upfile.path }} + {{ upfile.path }}
diff --git a/urls.py b/urls.py index c71eda3..dae0fb1 100644 --- a/urls.py +++ b/urls.py @@ -1,4 +1,4 @@ -from django.urls import path +from django.urls import path, re_path from django.views.generic import FormView from .views import upload, AllView, OneView from .forms import UploadModelFileForm @@ -7,5 +7,5 @@ urlpatterns = [ path('', upload, name='upload'), path('all', AllView.as_view(), name='all'), - path('', OneView.as_view(), name='one'), + re_path('^(?P.*)$', OneView.as_view(), name='one'), # 需要读取多段路径,只能采用re_path ] diff --git a/views.py b/views.py index 5112550..985ffc0 100644 --- a/views.py +++ b/views.py @@ -109,7 +109,7 @@ def upload(request): "iconbigurl": urljoin(current_uri, join(settings.MEDIA_URL, o.iconb.url)), } f.write(rule_repl.sub(lambda mt: gens[mt.group(2).lower()] if mt.group(2).lower( - ) in gens else mt.group(1) + mt.group(2) + mt.group(3), request.POST['plist']).encode('utf-8')) + ) in gens else mt.group(1) + mt.group(2) + mt.group(3), request.POST['plist'])) f.close() o.plist.name = path_plist_rela o.save() @@ -123,7 +123,7 @@ def upload(request): "iconbigurl": request.POST['iconbigurl'] if 'iconbigurl' in request.POST else '', } f.write(rule_repl.sub(lambda mt: gens[mt.group(2).lower()] if mt.group(2).lower( - ) in gens else mt.group(1) + mt.group(2) + mt.group(3), request.POST['plist']).encode('utf-8')) + ) in gens else mt.group(1) + mt.group(2) + mt.group(3), request.POST['plist'])) f.close() path_zip_rela = splitext(path_rela)[0] + '.zip'