mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
Custom deepcopy on Field classes
This commit is contained in:
parent
358445c174
commit
127c0bd3d6
|
@ -9,6 +9,7 @@ from rest_framework import ISO_8601
|
||||||
from rest_framework.compat import smart_text, EmailValidator, MinValueValidator, MaxValueValidator, URLValidator
|
from rest_framework.compat import smart_text, EmailValidator, MinValueValidator, MaxValueValidator, URLValidator
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.utils import html, representation, humanize_datetime
|
from rest_framework.utils import html, representation, humanize_datetime
|
||||||
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -150,6 +151,11 @@ class Field(object):
|
||||||
instance._kwargs = kwargs
|
instance._kwargs = kwargs
|
||||||
return instance
|
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):
|
def bind(self, field_name, parent, root):
|
||||||
"""
|
"""
|
||||||
Setup the context for the field instance.
|
Setup the context for the field instance.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user