replace loop with list comprehension

This commit is contained in:
Schylar Utley 2021-01-16 00:06:04 -06:00 committed by Christian Mäder
parent 8321449cc0
commit fe811f37bd
1 changed files with 1 additions and 3 deletions

View File

@ -18,9 +18,7 @@ def get_content_type_id(content_type_str):
for hook in webhooks: for hook in webhooks:
obj_types = hook.pop('object_types') obj_types = hook.pop('object_types')
obj_type_ids = [] obj_type_ids = [ get_content_type_id(obj) for obj in obj_types ]
for obj in obj_types:
obj_type_ids.append(get_content_type_id(obj))
if obj_type_ids is not None: if obj_type_ids is not None:
webhook = Webhook(**hook) webhook = Webhook(**hook)
if not Webhook.objects.filter(name=webhook.name): if not Webhook.objects.filter(name=webhook.name):