修复获取下载器导致在未创建数据库时无法执行makemigrations和migrate的bug

This commit is contained in:
ngfchl
2022-09-19 20:02:54 +08:00
parent 2e34631626
commit d5eac16e06

View File

@@ -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 = {
# 弹出层中的输入框配置
# 这里指定对话框的标题