How to call a static methods on a django model class during a south migration How to call a static methods on a django model class during a south migration python python

How to call a static methods on a django model class during a south migration


You can't use methods from models.py in south migrations. The reason is that in the future models.py will evolve and sooner or later you will delete those methods, then migration will be broken.

You should put all code needed by migration in migration file itself.


Here's the pertinent section of the South docs explaining why your methods don't work:

Rationale behind the serialisation


Aren't you using different names lookup_by_name and lookup_name?