Skip to content

Commit

Permalink
same logic, more pythonic
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Hill committed Nov 15, 2015
1 parent bac6f1f commit ff36cbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rest_framework/utils/model_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _get_fields(opts):


def _get_to_field(field):
return field.to_fields[0] if hasattr(field, 'to_fields') and field.to_fields else None
return getattr(field, 'to_fields', None) and field.to_fields[0]


def _get_forward_relationships(opts):
Expand Down

0 comments on commit ff36cbe

Please sign in to comment.