1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Refs #24215 -- Fixed Python 3.5 compatiblity for unhandled lazy ops error.

This commit is contained in:
Tim Graham
2015-09-16 09:10:59 -04:00
parent da5747f8e4
commit 7506616f16
2 changed files with 7 additions and 5 deletions

View File

@@ -244,11 +244,9 @@ class StateApps(Apps):
has a keyword argument called 'field'.
"""
def extract_field(operation):
# Expect a functools.partial() with a kwarg called 'field' applied.
try:
return operation.func.keywords['field']
except (AttributeError, KeyError):
return None
# operation is annotated with the field in
# apps.register.Apps.lazy_model_operation().
return getattr(operation, 'field', None)
def extract_field_names(operations):
return (str(field) for field in map(extract_field, operations) if field)