tomchristie/django-rest-framework — pull request #911 by thesamet (2013-06-05 04:34:40+00:00)
Title: Add support for passing callable as `source` argument for a field.

Sometimes it is desirable that the serialized form will contain a field that
is not directly accessible through a model attribute or method. That may
happen, for instance, if you are serializing a third-party model which you
cannot modify.

This change adds support for passing a callable as a `source` argument
for a field. That callable accepts a single argument which is the object
being serialized, and in turn, returns the value that goes into the field.