from django.db import models
from django.utils import timezone


class Migration(models.Model):
    
    migration_label = models.CharField(max_length=200)
    date_created = models.DateTimeField(default=timezone.now)
    content = models.TextField()
    scm_version = models.CharField(max_length=50, null=True, blank=True)
    
    def __unicode__(self):
        return unicode("%s [%s]" % (self.migration_label, self.scm_version))

from django.db import models

try:
    from django.utils.timezone import now
except ImportError:
    from datetime.datetime import now


class Migration(models.Model):
    
    migration_label = models.CharField(max_length=200)
    date_created = models.DateTimeField(default=now)
    content = models.TextField()
    scm_version = models.CharField(max_length=50, null=True, blank=True)
    
    def __unicode__(self):
        return unicode("%s [%s]" % (self.migration_label, self.scm_version))

Fix import error for Django 1.3.1
Fix import error for Django 1.3.1

  from django.db import models
- from django.utils import timezone
+ 
+ try:
+     from django.utils.timezone import now
+ except ImportError:
+     from datetime.datetime import now
  
  
  class Migration(models.Model):
      
      migration_label = models.CharField(max_length=200)
-     date_created = models.DateTimeField(default=timezone.now)
+     date_created = models.DateTimeField(default=now)
      content = models.TextField()
      scm_version = models.CharField(max_length=50, null=True, blank=True)
      
      def __unicode__(self):
          return unicode("%s [%s]" % (self.migration_label, self.scm_version))
  
Fix import error for Django 1.3.1
## Code Before:
from django.db import models
from django.utils import timezone


class Migration(models.Model):
    
    migration_label = models.CharField(max_length=200)
    date_created = models.DateTimeField(default=timezone.now)
    content = models.TextField()
    scm_version = models.CharField(max_length=50, null=True, blank=True)
    
    def __unicode__(self):
        return unicode("%s [%s]" % (self.migration_label, self.scm_version))

## Instruction:
Fix import error for Django 1.3.1
## Code After:
from django.db import models

try:
    from django.utils.timezone import now
except ImportError:
    from datetime.datetime import now


class Migration(models.Model):
    
    migration_label = models.CharField(max_length=200)
    date_created = models.DateTimeField(default=now)
    content = models.TextField()
    scm_version = models.CharField(max_length=50, null=True, blank=True)
    
    def __unicode__(self):
        return unicode("%s [%s]" % (self.migration_label, self.scm_version))
