Skip to content

Commit 8b02d93

Browse files
committed
improve value_omitted_from_data function
1 parent b0a90ec commit 8b02d93

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

postgres_composite_types/forms.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,8 @@ def value_from_datadict(self, data, files, name):
219219
}
220220

221221
def value_omitted_from_data(self, data, files, name):
222-
for key in data:
223-
if key.startswith('{}-'.format(name)):
224-
return False
225-
return True
222+
prefix = '{}-'.format(name)
223+
return not any(key.startswith(prefix) for key in data)
226224

227225
def id_for_label(self, id_):
228226
"""

0 commit comments

Comments
 (0)