From d5eac16e0682c80fded79813fce26889661f39d2 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Mon, 19 Sep 2022 20:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=99=A8=E5=AF=BC=E8=87=B4=E5=9C=A8=E6=9C=AA=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E6=97=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=A7=E8=A1=8Cmakemigrations=E5=92=8Cmigrate=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/admin.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pt_site/admin.py b/pt_site/admin.py index 2abca2c..54b78ae 100644 --- a/pt_site/admin.py +++ b/pt_site/admin.py @@ -675,6 +675,14 @@ class DownloaderAdmin(ImportExportModelAdmin, AjaxAdmin): # instead of ModelAdm # print(sender.test_connect(kwargs['instance'])) +def get_downloader(): + """获取下载器列表""" + try: + return [{'key': i.id, 'label': i.name} for i in Downloader.objects.all()] + except Exception as e: + return [] + + @admin.register(TorrentInfo) class TorrentInfoAdmin(ImportExportModelAdmin, AjaxAdmin): # instead of ModelAdmin formats = (base_formats.XLS, base_formats.CSV, base_formats.JSON) @@ -953,13 +961,6 @@ class TorrentInfoAdmin(ImportExportModelAdmin, AjaxAdmin): # instead of ModelAd # time.sleep(2) # 可以根据request的用户,来动态设置返回哪些字段,每次点击都会来获取配置显示 - def get_downloader(self): - """获取下载器列表""" - try: - return [{'key': i.id, 'label': i.name} for i in Downloader.objects.all()] - except Exception as e: - return [] - to_download.layer = { # 弹出层中的输入框配置 # 这里指定对话框的标题