##// END OF EJS Templates
Run js highlight on the new posts only, not on all page each time. Add...
Run js highlight on the new posts only, not on all page each time. Add highlight to the reflink popups

File last commit:

r693:641dff39 1.8-dev
r709:e6788412 default
Show More
0028_auto__del_field_post_image_pre_height__del_field_post_image__del_field.py
140 lines | 8.5 KiB | text/x-python | PythonLexer
/ boards / migrations / 0028_auto__del_field_post_image_pre_height__del_field_post_image__del_field.py
neko259
Moved post image to a separate model. Each post (as of model) can contain multiple images now. The image shown to the user is got with get_first_image method
r693 # -*- 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.image_pre_height'
db.delete_column(u'boards_post', 'image_pre_height')
# Deleting field 'Post.image'
db.delete_column(u'boards_post', 'image')
# Deleting field 'Post.image_pre_width'
db.delete_column(u'boards_post', 'image_pre_width')
# Deleting field 'Post.image_width'
db.delete_column(u'boards_post', 'image_width')
# Deleting field 'Post.image_height'
db.delete_column(u'boards_post', 'image_height')
# Deleting field 'Post.image_hash'
db.delete_column(u'boards_post', 'image_hash')
def backwards(self, orm):
# Adding field 'Post.image_pre_height'
db.add_column(u'boards_post', 'image_pre_height',
self.gf('django.db.models.fields.IntegerField')(default=0),
keep_default=False)
# User chose to not deal with backwards NULL issues for 'Post.image'
raise RuntimeError("Cannot reverse this migration. 'Post.image' and its values cannot be restored.")
# The following code is provided here to aid in writing a correct migration # Adding field 'Post.image'
db.add_column(u'boards_post', 'image',
self.gf('boards.thumbs.ImageWithThumbsField')(max_length=100, blank=True),
keep_default=False)
# Adding field 'Post.image_pre_width'
db.add_column(u'boards_post', 'image_pre_width',
self.gf('django.db.models.fields.IntegerField')(default=0),
keep_default=False)
# Adding field 'Post.image_width'
db.add_column(u'boards_post', 'image_width',
self.gf('django.db.models.fields.IntegerField')(default=0),
keep_default=False)
# Adding field 'Post.image_height'
db.add_column(u'boards_post', 'image_height',
self.gf('django.db.models.fields.IntegerField')(default=0),
keep_default=False)
# User chose to not deal with backwards NULL issues for 'Post.image_hash'
raise RuntimeError("Cannot reverse this migration. 'Post.image_hash' and its values cannot be restored.")
# The following code is provided here to aid in writing a correct migration # Adding field 'Post.image_hash'
db.add_column(u'boards_post', 'image_hash',
self.gf('django.db.models.fields.CharField')(max_length=36),
keep_default=False)
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': {'ordering': "('id',)", 'object_name': 'Post'},
'_text_rendered': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'images': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'ip+'", 'to': "orm['boards.PostImage']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True', 'db_index': 'True'}),
'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', [], {'related_name': "'rfp+'", 'to': "orm['boards.Post']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True', 'db_index': 'True'}),
'refmap': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}),
'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}),
'thread_new': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Thread']", 'null': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.User']", 'null': 'True'})
},
'boards.postimage': {
'Meta': {'ordering': "('id',)", 'object_name': 'PostImage'},
'hash': ('django.db.models.fields.CharField', [], {'max_length': '36'}),
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}),
'pre_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'pre_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'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': {'ordering': "('name',)", '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', 'db_index': 'True'}),
'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'},
'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'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']"}),
'hidden_tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'ht+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Tag']"}),
'hidden_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'hth+'", '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']