Skip to content

Commit

Permalink
Merge pull request #3635 from martinhill/issue_3634
Browse files Browse the repository at this point in the history
Relation fields no to_fields attribute attribute break serializer
  • Loading branch information
tomchristie committed Nov 16, 2015
2 parents 4eef2ea + ff36cbe commit 316c374
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 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 316c374

Please sign in to comment.