replace loop with list comprehension
This commit is contained in:
parent
8321449cc0
commit
fe811f37bd
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user