can give solid example of deconstruct() mentioned in https://docs.djangoproject.com/en/1.8/topics/migrations/#migration-serializing. read doc, , can't understand example.
there related django ticket - https://code.djangoproject.com/ticket/22951 , here example:
class klass: def __init__(self, x, y, sep=','): self.x = x self.y = y self.sep = sep def __str__(self): return self.sep.join((str(self.x), str(self.y))) def deconstruct(self): return 'python.path.to.your.klass', [self.x, self.y], \ {'sep': self.sep}
and of course don't forget order of returned list of args
should same original order (from __init__
method) of positional arguments.
Comments
Post a Comment