Add creation date time field to bootstrap fixtures
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Adding field 'BootstrapSetup.created'
|
||||
db.add_column('bootstrap_bootstrapsetup', 'created',
|
||||
self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2012, 10, 8, 0, 0)),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'BootstrapSetup.created'
|
||||
db.delete_column('bootstrap_bootstrapsetup', 'created')
|
||||
|
||||
|
||||
models = {
|
||||
'bootstrap.bootstrapsetup': {
|
||||
'Meta': {'ordering': "['name']", 'object_name': 'BootstrapSetup'},
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 10, 8, 0, 0)'}),
|
||||
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||
'fixture': ('django.db.models.fields.TextField', [], {}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'type': ('django.db.models.fields.CharField', [], {'max_length': '16'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['bootstrap']
|
||||
@@ -3,6 +3,7 @@ from __future__ import absolute_import
|
||||
import os
|
||||
import tempfile
|
||||
import re
|
||||
import datetime
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
@@ -26,6 +27,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: datetime.datetime.now(), editable=False)
|
||||
|
||||
objects = BootstrapSetupManager()
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ def bootstrap_setup_list(request):
|
||||
'extra_columns': [
|
||||
{'name': _(u'description'), 'attribute': 'description'},
|
||||
{'name': _(u'type'), 'attribute': 'get_type_display'},
|
||||
{'name': _(u'created'), 'attribute': 'created'},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user