v2.py 629 B

12345678910111213141516171819202122232425
  1. """
  2. API versioning file; we can tell what kind of migrations things are
  3. by what class they inherit from (if none, it's a v1).
  4. """
  5. from south.utils import ask_for_it_by_name
  6. class BaseMigration(object):
  7. def gf(self, field_name):
  8. "Gets a field by absolute reference."
  9. field = ask_for_it_by_name(field_name)
  10. field.model = FakeModel
  11. return field
  12. class SchemaMigration(BaseMigration):
  13. pass
  14. class DataMigration(BaseMigration):
  15. # Data migrations shouldn't be dry-run
  16. no_dry_run = True
  17. class FakeModel(object):
  18. "Fake model so error messages on fields don't explode"
  19. pass