perf: 添加生成 platform

This commit is contained in:
ibuler
2022-08-22 15:23:28 +08:00
parent dd0b8e988c
commit f0c9c2b1ad
2 changed files with 6 additions and 2 deletions

View File

@@ -30,9 +30,12 @@ class PlatformGenerator(FakeDataGenerator):
def do_generate(self, batch, batch_size):
platforms = []
for i in batch:
category = choice(self.categories)
tp = choice(self.category_type[category].choices)
data = {
'name': forgery_py.name.company_name(),
'category': ''
'category': choice(self.categories),
'type': tp
}
platforms.append(Platform(**data))
Platform.objects.bulk_create(platforms, ignore_conflicts=True)