perf: 优化 custom info

pull/10169/head
ibuler 2023-04-10 15:18:27 +08:00
parent 616e636837
commit 907fcd7555
2 changed files with 10 additions and 7 deletions

View File

@ -4,7 +4,11 @@ from .base import BaseType
class CustomTypes(BaseType):
@classmethod
def get_choices(cls):
types = cls.get_custom_platforms().values_list('type', flat=True).distinct()
try:
platforms = list(cls.get_custom_platforms())
except Exception:
return []
types = [p.type for p in platforms]
return [(t, t) for t in types]
@classmethod

View File

@ -32,14 +32,13 @@ class Migration(migrations.Migration):
name='custom_info',
field=models.JSONField(default=dict, verbose_name='Custom info'),
),
migrations.RenameField(
model_name='asset',
old_name='info',
new_name='gathered_info',
),
migrations.AlterField(
migrations.AddField(
model_name='asset',
name='gathered_info',
field=models.JSONField(blank=True, default=dict, verbose_name='Gathered info'),
),
migrations.RemoveField(
model_name='asset',
name='info',
),
]