Commit 01e2a342 by Tom Christie

Merge pull request #1594 from jcsp/wip-methodfield

fields: allow help_text on SerializerMethodField
parents 218b94e6 04c820b8
...@@ -1027,9 +1027,9 @@ class SerializerMethodField(Field): ...@@ -1027,9 +1027,9 @@ class SerializerMethodField(Field):
A field that gets its value by calling a method on the serializer it's attached to. 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 self.method_name = method_name
super(SerializerMethodField, self).__init__() super(SerializerMethodField, self).__init__(*args, **kwargs)
def field_to_native(self, obj, field_name): def field_to_native(self, obj, field_name):
value = getattr(self.parent, self.method_name)(obj) value = getattr(self.parent, self.method_name)(obj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment