Use auto_now_add in the bootstrap app model
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Changing field 'BootstrapSetup.created'
|
||||
db.alter_column(u'bootstrap_bootstrapsetup', 'created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True))
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'BootstrapSetup.created'
|
||||
db.alter_column(u'bootstrap_bootstrapsetup', 'created', self.gf('django.db.models.fields.DateTimeField')())
|
||||
|
||||
models = {
|
||||
u'bootstrap.bootstrapsetup': {
|
||||
'Meta': {'ordering': "['name']", 'object_name': 'BootstrapSetup'},
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||
'fixture': ('django.db.models.fields.TextField', [], {}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||
'type': ('django.db.models.fields.CharField', [], {'max_length': '16'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['bootstrap']
|
||||
@@ -14,7 +14,6 @@ except ImportError:
|
||||
from django.core import management
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.db import models
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .classes import BootstrapModel, FixtureMetadata
|
||||
@@ -32,7 +31,7 @@ class BootstrapSetup(models.Model):
|
||||
description = models.TextField(verbose_name=_(u'Description'), blank=True)
|
||||
fixture = models.TextField(verbose_name=_(u'Fixture'), help_text=_(u'These are the actual database structure creation instructions.'))
|
||||
type = models.CharField(max_length=16, verbose_name=_(u'Type'), choices=FIXTURE_TYPES_CHOICES)
|
||||
created = models.DateTimeField(verbose_name=_('Creation date and time'), default=lambda: now(), editable=False)
|
||||
created = models.DateTimeField(verbose_name=_('Creation date and time'), auto_now_add=True)
|
||||
|
||||
objects = BootstrapSetupManager()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user