From 64c49f8c47f7ea0578447b1a4ba36909ecfda2d0 Mon Sep 17 00:00:00 2001 From: Tom Jaster Date: Tue, 20 Jan 2015 22:17:28 +0100 Subject: [PATCH] =?UTF-8?q?From=20this=20i=20believe=20it=20is=20field=5Fn?= =?UTF-8?q?ame=20pre=20django=201.6.=20I=20still=20don=E2=80=99t=20have=20?= =?UTF-8?q?django=201.5=20installed=20so=20it=20is=20an=20educated=20guess?= =?UTF-8?q?=20by=20looking=20at=20ManyToOneRel=20and=20ForeignKey=20https:?= =?UTF-8?q?//github.com/django/django/blob/stable/1.5.x/django/db/models/f?= =?UTF-8?q?ields/related.py#L915?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rest_framework/compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index a1b25f819..82ad0ea93 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -158,7 +158,7 @@ if django.VERSION >= (1, 6): return field.to_fields[0] if len(field.to_fields) else None else: def get_to_field(field): - return field.to_field + return field.field_name # URLValidator only accepts `message` in 1.6+