e95c79af7a41a4f38c2e0ab8ddc74d8f0d80d60f
[wolnelektury.git] / apps / south / models.py
1 from django.db import models
2
3 class MigrationHistory(models.Model):
4     app_name = models.CharField(max_length=255)
5     migration = models.CharField(max_length=255)
6     applied = models.DateTimeField(blank=True, null=True)
7
8     @classmethod
9     def for_migration(cls, app_name, migration):
10         try:
11             return cls.objects.get(
12                 app_name = app_name,
13                 migration = migration,
14             )
15         except cls.DoesNotExist:
16             return cls(
17                 app_name = app_name,
18                 migration = migration,
19             )