aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorGustavo Andrés Angulo2013-05-29 11:45:54 -0500
committerGustavo Andrés Angulo2013-05-29 11:45:54 -0500
commitde1cc5f8c1393149781a8f9365449693af18af4e (patch)
tree2c607e254a17f0fcbe213ce9294eca8e5437a1db /rest_framework/fields.py
parentc98ac3e83e537577cb90b2840c022e13e1c3c2b1 (diff)
downloaddjango-rest-framework-de1cc5f8c1393149781a8f9365449693af18af4e.tar.bz2
Fix default field when is a simple callable function.
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 1534eeca..30bbafc4 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -250,6 +250,9 @@ class WritableField(Field):
self.validators = self.default_validators + validators
self.default = default if default is not None else self.default
+ if is_simple_callable(self.default):
+ self.default = self.default()
+
# Widgets are ony used for HTML forms.
widget = widget or self.widget
if isinstance(widget, type):