##// END OF EJS Templates
Changed moderator panel style in MD theme
Changed moderator panel style in MD theme

File last commit:

r398:b2448061 default
r578:99c4948b default
Show More
0016_auto__del_field_post_bump_time.py
109 lines | 6.6 KiB | text/x-python | PythonLexer
/ boards / migrations / 0016_auto__del_field_post_bump_time.py
neko259
Split up post model into post and thread to normalise models. Still need some refactoring
r398 # -*- 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):
# Deleting field 'Post.bump_time'
db.delete_column(u'boards_post', 'bump_time')
# Removing M2M table for field tags on 'Post'
db.delete_table(db.shorten_name(u'boards_post_tags'))
# Removing M2M table for field replies on 'Post'
db.delete_table(db.shorten_name(u'boards_post_replies'))
def backwards(self, orm):
# User chose to not deal with backwards NULL issues for 'Post.bump_time'
raise RuntimeError("Cannot reverse this migration. 'Post.bump_time' and its values cannot be restored.")
# The following code is provided here to aid in writing a correct migration # Adding field 'Post.bump_time'
db.add_column(u'boards_post', 'bump_time',
self.gf('django.db.models.fields.DateTimeField')(),
keep_default=False)
# 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['boards.post'], null=False)),
('tag', models.ForeignKey(orm['boards.tag'], null=False))
))
db.create_unique(m2m_table_name, ['post_id', 'tag_id'])
# Adding M2M table for field replies on 'Post'
m2m_table_name = db.shorten_name(u'boards_post_replies')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('from_post', models.ForeignKey(orm['boards.post'], null=False)),
('to_post', models.ForeignKey(orm['boards.post'], null=False))
))
db.create_unique(m2m_table_name, ['from_post_id', 'to_post_id'])
models = {
'boards.ban': {
'Meta': {'object_name': 'Ban'},
'can_read': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}),
'reason': ('django.db.models.fields.CharField', [], {'default': "'Auto'", 'max_length': '200'})
},
'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'}),
'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}),
'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}),
'poster_user_agent': ('django.db.models.fields.TextField', [], {}),
'pub_time': ('django.db.models.fields.DateTimeField', [], {}),
'referenced_posts': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'rfp+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}),
'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}),
'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}),
'thread': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Post']", 'null': 'True'}),
'thread_new': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Thread']", 'null': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.User']", 'null': 'True'})
},
'boards.setting': {
'Meta': {'object_name': 'Setting'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.User']"}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'boards.tag': {
'Meta': {'object_name': 'Tag'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'linked': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tag+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Thread']"})
},
'boards.thread': {
'Meta': {'object_name': 'Thread'},
'bump_time': ('django.db.models.fields.DateTimeField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}),
'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tre+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}),
'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['boards.Tag']", 'symmetrical': 'False'})
},
'boards.user': {
'Meta': {'object_name': 'User'},
'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}),
'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'rank': ('django.db.models.fields.IntegerField', [], {}),
'registration_time': ('django.db.models.fields.DateTimeField', [], {}),
'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'})
}
}
complete_apps = ['boards']