aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorJohn Spray2014-05-22 15:24:35 +0100
committerJohn Spray2014-05-22 15:24:35 +0100
commit04c820b8e5e4ae153eacd1cbf19b39286c374e87 (patch)
tree2f69e141fc0e8e195d08e5600ca08cbc531f8db4 /rest_framework/fields.py
parent218b94e60696de649407f9292359e02e5daa787d (diff)
downloaddjango-rest-framework-04c820b8e5e4ae153eacd1cbf19b39286c374e87.tar.bz2
fields: allow help_text on SerializerMethodField
...by passing through any extra *args and **kwargs to the parent constructor. Previously one couldn't assign help_text to a SerializerMethodField during construction.
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 2da89550..4ac5285e 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -1027,9 +1027,9 @@ class SerializerMethodField(Field):
A field that gets its value by calling a method on the serializer it's attached to.
"""
- def __init__(self, method_name):
+ def __init__(self, method_name, *args, **kwargs):
self.method_name = method_name
- super(SerializerMethodField, self).__init__()
+ super(SerializerMethodField, self).__init__(*args, **kwargs)
def field_to_native(self, obj, field_name):
value = getattr(self.parent, self.method_name)(obj)