Show More
@@ -1,110 +1,110 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | from south.utils import datetime_utils as datetime |
|
3 | 3 | from south.db import db |
|
4 | 4 | from south.v2 import DataMigration |
|
5 | 5 | from django.db import models |
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | class Migration(DataMigration): |
|
9 | 9 | |
|
10 | 10 | def forwards(self, orm): |
|
11 | 11 | for post in orm['boards.Post'].objects.all(): |
|
12 | 12 | if post.image: |
|
13 | 13 | image = orm['boards.PostImage']() |
|
14 | 14 | |
|
15 | 15 | image.width = post.image_width |
|
16 | 16 | image.height = post.image_height |
|
17 | 17 | |
|
18 | 18 | image.pre_width = post.image_pre_width |
|
19 | 19 | image.pre_height = post.image_pre_height |
|
20 | 20 | |
|
21 | 21 | image.image = post.image |
|
22 | 22 | image.hash = post.image_hash |
|
23 | 23 | |
|
24 | 24 | image.save() |
|
25 | 25 | |
|
26 | post.images.clear() | |
|
26 | 27 | post.images.add(image) |
|
27 | post.save() | |
|
28 | 28 | |
|
29 | 29 | def backwards(self, orm): |
|
30 | 30 | "Write your backwards methods here." |
|
31 | 31 | |
|
32 | 32 | models = { |
|
33 | 33 | 'boards.ban': { |
|
34 | 34 | 'Meta': {'object_name': 'Ban'}, |
|
35 | 35 | 'can_read': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), |
|
36 | 36 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
37 | 37 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), |
|
38 | 38 | 'reason': ('django.db.models.fields.CharField', [], {'default': "'Auto'", 'max_length': '200'}) |
|
39 | 39 | }, |
|
40 | 40 | 'boards.post': { |
|
41 | 41 | 'Meta': {'ordering': "('id',)", 'object_name': 'Post'}, |
|
42 | 42 | '_text_rendered': ('django.db.models.fields.TextField', [], {}), |
|
43 | 43 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
44 | 44 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), |
|
45 | 45 | 'image_hash': ('django.db.models.fields.CharField', [], {'max_length': '36'}), |
|
46 | 46 | 'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
47 | 47 | 'image_pre_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
48 | 48 | 'image_pre_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
49 | 49 | 'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
50 | 50 | 'images': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'ip+'", 'to': "orm['boards.PostImage']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True', 'db_index': 'True'}), |
|
51 | 51 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
52 | 52 | 'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), |
|
53 | 53 | 'poster_user_agent': ('django.db.models.fields.TextField', [], {}), |
|
54 | 54 | 'pub_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
55 | 55 | 'referenced_posts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'rfp+'", 'to': "orm['boards.Post']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True', 'db_index': 'True'}), |
|
56 | 56 | 'refmap': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), |
|
57 | 57 | 'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), |
|
58 | 58 | 'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}), |
|
59 | 59 | 'thread_new': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Thread']", 'null': 'True'}), |
|
60 | 60 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}), |
|
61 | 61 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.User']", 'null': 'True'}) |
|
62 | 62 | }, |
|
63 | 63 | 'boards.postimage': { |
|
64 | 64 | 'Meta': {'ordering': "('id',)", 'object_name': 'PostImage'}, |
|
65 | 65 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
66 | 66 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), |
|
67 | 67 | 'hash': ('django.db.models.fields.CharField', [], {'max_length': '36'}), |
|
68 | 68 | 'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
69 | 69 | 'pre_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
70 | 70 | 'pre_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
71 | 71 | 'width': ('django.db.models.fields.IntegerField', [], {'default': '0'}) |
|
72 | 72 | }, |
|
73 | 73 | 'boards.setting': { |
|
74 | 74 | 'Meta': {'object_name': 'Setting'}, |
|
75 | 75 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
76 | 76 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), |
|
77 | 77 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.User']"}), |
|
78 | 78 | 'value': ('django.db.models.fields.CharField', [], {'max_length': '50'}) |
|
79 | 79 | }, |
|
80 | 80 | 'boards.tag': { |
|
81 | 81 | 'Meta': {'ordering': "('name',)", 'object_name': 'Tag'}, |
|
82 | 82 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
83 | 83 | 'linked': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), |
|
84 | 84 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}), |
|
85 | 85 | 'threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tag+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Thread']"}) |
|
86 | 86 | }, |
|
87 | 87 | 'boards.thread': { |
|
88 | 88 | 'Meta': {'object_name': 'Thread'}, |
|
89 | 89 | 'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), |
|
90 | 90 | 'bump_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
91 | 91 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
92 | 92 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
93 | 93 | 'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tre+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), |
|
94 | 94 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['boards.Tag']", 'symmetrical': 'False'}) |
|
95 | 95 | }, |
|
96 | 96 | 'boards.user': { |
|
97 | 97 | 'Meta': {'object_name': 'User'}, |
|
98 | 98 | 'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), |
|
99 | 99 | 'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), |
|
100 | 100 | 'hidden_tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'ht+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Tag']"}), |
|
101 | 101 | 'hidden_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'hth+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), |
|
102 | 102 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
103 | 103 | 'rank': ('django.db.models.fields.IntegerField', [], {}), |
|
104 | 104 | 'registration_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
105 | 105 | 'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}) |
|
106 | 106 | } |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | complete_apps = ['boards'] |
|
110 | 110 | symmetrical = True |
General Comments 0
You need to be logged in to leave comments.
Login now