aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorTom Christie2014-09-24 20:25:59 +0100
committerTom Christie2014-09-24 20:25:59 +0100
commit127c0bd3d68860dd6567d81047257fbc3e70b4b9 (patch)
treea35e023266e5f20baa12c63a1f7faed4eddf4430 /rest_framework/fields.py
parent358445c174629bdd55894c48eaf965bbfd4414b2 (diff)
downloaddjango-rest-framework-127c0bd3d68860dd6567d81047257fbc3e70b4b9.tar.bz2
Custom deepcopy on Field classes
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index f859658a..1f7d964a 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -9,6 +9,7 @@ from rest_framework import ISO_8601
from rest_framework.compat import smart_text, EmailValidator, MinValueValidator, MaxValueValidator, URLValidator
from rest_framework.settings import api_settings
from rest_framework.utils import html, representation, humanize_datetime
+import copy
import datetime
import decimal
import inspect
@@ -150,6 +151,11 @@ class Field(object):
instance._kwargs = kwargs
return instance
+ def __deepcopy__(self, memo):
+ args = copy.deepcopy(self._args)
+ kwargs = copy.deepcopy(self._kwargs)
+ return self.__class__(*args, **kwargs)
+
def bind(self, field_name, parent, root):
"""
Setup the context for the field instance.