Skip to content

Commit

Permalink
check if field.to_fields is None
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Hill committed Nov 14, 2015
1 parent e475464 commit bac6f1f
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') else None
return field.to_fields[0] if hasattr(field, 'to_fields') and field.to_fields else None


def _get_forward_relationships(opts):
Expand Down

0 comments on commit bac6f1f

Please sign in to comment.