diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-14 03:29:39 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-14 03:29:39 +0000 |
| commit | 70e5dce3651de6f5494233802a5de609182045df (patch) | |
| tree | a4a8cf7aec23c3dd061079482db35a2af8e1f5d8 /django/newforms/fields.py | |
| parent | 813c48e6eb146a06d40b4d11efebee1d1493665d (diff) | |
Fixed #3489 -- Added proper deepcopying to form fields so that widget instances get copied as well. Patch from Jonathan Buchanan and insin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6156 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/fields.py')
| -rw-r--r-- | django/newforms/fields.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/newforms/fields.py b/django/newforms/fields.py index fc816a842b..a2d8afbdeb 100644 --- a/django/newforms/fields.py +++ b/django/newforms/fields.py @@ -2,6 +2,7 @@ Field classes """ +import copy import datetime import re import time @@ -100,6 +101,12 @@ class Field(object): """ return {} + def __deepcopy__(self, memo): + result = copy.copy(self) + memo[id(self)] = result + result.widget = copy.deepcopy(self.widget, memo) + return result + class CharField(Field): def __init__(self, max_length=None, min_length=None, *args, **kwargs): self.max_length, self.min_length = max_length, min_length |
