From this question I had the idea to redefine depth in my Django models. I took a snippet of code from this question and put it in my model with the following signature:
def __deepcopy__(self, *args, **kwargs):
However, I want to be able to pass the parameters "field" and "value", but this does not work. When I call:
deepcopy(s1, field='foo',value='bar')
with parameters trying to extract from the method body using kwargs ['field'] and kwargs ['value'], I get the following error:
File "<stdin>", line 1, in <module>
TypeError: deepcopy() got an unexpected keyword argument 'field'
By the way, I assume that I need to import the deepcopy method to use it in general, which I do with:
from copy import deepcopy
There is some mistake in my understanding, thanks in advance for the explanation.
source
share