summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/south/models.py
diff options
context:
space:
mode:
authorttt2017-05-13 00:29:47 +0530
committerttt2017-05-13 00:29:47 +0530
commitabf599be33b383a6a5baf9493093b2126a622ac8 (patch)
tree4c5ab6e0d935d5e65fabcf0258e4a00dd20a5afa /lib/python2.7/site-packages/south/models.py
downloadSBHS-2018-Rpi-abf599be33b383a6a5baf9493093b2126a622ac8.tar.gz
SBHS-2018-Rpi-abf599be33b383a6a5baf9493093b2126a622ac8.tar.bz2
SBHS-2018-Rpi-abf599be33b383a6a5baf9493093b2126a622ac8.zip
added all server files
Diffstat (limited to 'lib/python2.7/site-packages/south/models.py')
-rw-r--r--lib/python2.7/site-packages/south/models.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/python2.7/site-packages/south/models.py b/lib/python2.7/site-packages/south/models.py
new file mode 100644
index 0000000..8239d61
--- /dev/null
+++ b/lib/python2.7/site-packages/south/models.py
@@ -0,0 +1,37 @@
+from django.db import models
+from south.db import DEFAULT_DB_ALIAS
+
+class MigrationHistory(models.Model):
+ app_name = models.CharField(max_length=255)
+ migration = models.CharField(max_length=255)
+ applied = models.DateTimeField(blank=True)
+
+ @classmethod
+ def for_migration(cls, migration, database):
+ try:
+ # Switch on multi-db-ness
+ if database != DEFAULT_DB_ALIAS:
+ # Django 1.2
+ objects = cls.objects.using(database)
+ else:
+ # Django <= 1.1
+ objects = cls.objects
+ return objects.get(
+ app_name=migration.app_label(),
+ migration=migration.name(),
+ )
+ except cls.DoesNotExist:
+ return cls(
+ app_name=migration.app_label(),
+ migration=migration.name(),
+ )
+
+ def get_migrations(self):
+ from south.migration.base import Migrations
+ return Migrations(self.app_name)
+
+ def get_migration(self):
+ return self.get_migrations().migration(self.migration)
+
+ def __str__(self):
+ return "<%s: %s>" % (self.app_name, self.migration)