tomchristie/django-rest-framework — pull request #901 by woakas (2013-05-29 16:55:38+00:00)
Title: Fix default field when is a simple callable function

When I have::

from time import time

def utc_now_miliseconds():
return (int(time() * 1000))

class HouseSerializer(serializers.Serializer):
name = serializers.CharField(max_length=200)
timestamp = serializers.IntegerField(default=utcnow_miliseconds)

If I consume an endpoint with this serializer the function return the value::

curl -XPOST -d "name=23" http://localhost:8000/api/home/

the values are name=23 and timestamp is some 1369846517231