##// END OF EJS Templates
Small code cleanups
Small code cleanups

File last commit:

r114:96ce3526 default
r721:1814d7a8 default
Show More
0001_initial.py
94 lines | 4.6 KiB | text/x-python | PythonLexer
neko259
Added initial database migration. Added south support. This fixes #41
r114 # -*- 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 model 'Tag'
db.create_table(u'boards_tag', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
))
db.send_create_signal(u'boards', ['Tag'])
# Adding model 'Post'
db.create_table(u'boards_post', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=50)),
('pub_time', self.gf('django.db.models.fields.DateTimeField')()),
('text', self.gf('markupfield.fields.MarkupField')(rendered_field=True)),
('text_markup_type', self.gf('django.db.models.fields.CharField')(default='markdown', max_length=30)),
('image', self.gf('boards.thumbs.ImageWithThumbsField')(max_length=100, blank=True)),
('poster_ip', self.gf('django.db.models.fields.IPAddressField')(max_length=15)),
('_text_rendered', self.gf('django.db.models.fields.TextField')()),
('poster_user_agent', self.gf('django.db.models.fields.TextField')()),
('parent', self.gf('django.db.models.fields.BigIntegerField')()),
('last_edit_time', self.gf('django.db.models.fields.DateTimeField')()),
))
db.send_create_signal(u'boards', ['Post'])
# Adding M2M table for field tags on 'Post'
m2m_table_name = db.shorten_name(u'boards_post_tags')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('post', models.ForeignKey(orm[u'boards.post'], null=False)),
('tag', models.ForeignKey(orm[u'boards.tag'], null=False))
))
db.create_unique(m2m_table_name, ['post_id', 'tag_id'])
# Adding model 'Admin'
db.create_table(u'boards_admin', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
('password', self.gf('django.db.models.fields.CharField')(max_length=100)),
))
db.send_create_signal(u'boards', ['Admin'])
def backwards(self, orm):
# Deleting model 'Tag'
db.delete_table(u'boards_tag')
# Deleting model 'Post'
db.delete_table(u'boards_post')
# Removing M2M table for field tags on 'Post'
db.delete_table(db.shorten_name(u'boards_post_tags'))
# Deleting model 'Admin'
db.delete_table(u'boards_admin')
models = {
u'boards.admin': {
'Meta': {'object_name': 'Admin'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'boards.post': {
'Meta': {'object_name': 'Post'},
'_text_rendered': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}),
'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}),
'parent': ('django.db.models.fields.BigIntegerField', [], {}),
'poster_ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
'poster_user_agent': ('django.db.models.fields.TextField', [], {}),
'pub_time': ('django.db.models.fields.DateTimeField', [], {}),
'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['boards.Tag']", 'symmetrical': 'False'}),
'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}),
'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'boards.tag': {
'Meta': {'object_name': 'Tag'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
}
}
complete_apps = ['boards']