mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-05-03 08:14:42 +00:00
Implemented __deepcopy__ to avoid infinite recursion in __getattr__ while deepcopying a Choices instance
This commit is contained in:
parent
15910e04e7
commit
5f291a6a4a
1 changed files with 5 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
|
||||
|
||||
class Choices(object):
|
||||
"""
|
||||
|
|
@ -80,3 +82,6 @@ class Choices(object):
|
|||
def __contains__(self, item):
|
||||
if item in self._choice_dict.values():
|
||||
return True
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
return self.__class__(*copy.deepcopy(self._full, memo))
|
||||
|
|
|
|||
Loading…
Reference in a new issue