From 7166c35a8788a77675fc694414ee06b54db6f8dc Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 16 Oct 2017 11:16:13 +0200 Subject: [PATCH] Allow functools.partial in is_simple_callable check --- rest_framework/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index adb002689..43fed9aee 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -4,6 +4,7 @@ import collections import copy import datetime import decimal +import functools import inspect import re import uuid @@ -54,7 +55,7 @@ if six.PY3: """ True if the object is a callable that takes no arguments. """ - if not (inspect.isfunction(obj) or inspect.ismethod(obj)): + if not (inspect.isfunction(obj) or inspect.ismethod(obj) or isinstance(obj, functools.partial)): return False sig = inspect.signature(obj)