mirror of
https://github.com/django/django.git
synced 2025-04-15 04:44:37 +00:00
Use list comprehension instead a for loop
This commit is contained in:
parent
a8deea21ce
commit
e35596881f
@ -213,14 +213,10 @@ class Command(BaseCommand):
|
||||
indent = 4 if pretty else None
|
||||
|
||||
# Having keys in the resulting JSON makes it more useful
|
||||
url_pattern_dicts = []
|
||||
for route, view, name in url_patterns:
|
||||
url_pattern_dict = {
|
||||
"route": route,
|
||||
"view": view,
|
||||
"name": name,
|
||||
}
|
||||
url_pattern_dicts.append(url_pattern_dict)
|
||||
url_pattern_dicts = [
|
||||
{"route": route, "view": view, "name": name}
|
||||
for route, view, name in url_patterns
|
||||
]
|
||||
|
||||
return json.dumps(url_pattern_dicts, indent=indent)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user