Show More
@@ -1,81 +1,75 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | import datetime |
|
2 | import datetime | |
3 | from south.db import db |
|
3 | from south.db import db | |
4 | from south.v2 import SchemaMigration |
|
4 | from south.v2 import SchemaMigration | |
5 | from django.db import models |
|
5 | from django.db import models | |
6 | from boards.models import Post, NO_PARENT |
|
6 | from boards.models import Post, NO_PARENT | |
7 |
|
7 | |||
8 |
|
8 | |||
9 | class Migration(SchemaMigration): |
|
9 | class Migration(SchemaMigration): | |
10 |
|
10 | |||
11 | def forwards(self, orm): |
|
11 | def forwards(self, orm): | |
12 | # Adding M2M table for field replies on 'Post' |
|
12 | # Adding M2M table for field replies on 'Post' | |
13 | m2m_table_name = db.shorten_name(u'boards_post_replies') |
|
13 | m2m_table_name = db.shorten_name(u'boards_post_replies') | |
14 | db.create_table(m2m_table_name, ( |
|
14 | db.create_table(m2m_table_name, ( | |
15 | ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), |
|
15 | ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), | |
16 | ('from_post', models.ForeignKey(orm[u'boards.post'], null=False)), |
|
16 | ('from_post', models.ForeignKey(orm[u'boards.post'], null=False)), | |
17 | ('to_post', models.ForeignKey(orm[u'boards.post'], null=False)) |
|
17 | ('to_post', models.ForeignKey(orm[u'boards.post'], null=False)) | |
18 | )) |
|
18 | )) | |
19 | db.create_unique(m2m_table_name, ['from_post_id', 'to_post_id']) |
|
19 | db.create_unique(m2m_table_name, ['from_post_id', 'to_post_id']) | |
20 |
|
20 | |||
21 | for post in Post.objects.all(): |
|
|||
22 | if post.parent != NO_PARENT: |
|
|||
23 | parent = Post.objects.get(id=post.parent) |
|
|||
24 | parent.replies.add(post) |
|
|||
25 |
|
||||
26 |
|
||||
27 | def backwards(self, orm): |
|
21 | def backwards(self, orm): | |
28 | # Removing M2M table for field replies on 'Post' |
|
22 | # Removing M2M table for field replies on 'Post' | |
29 | db.delete_table(db.shorten_name(u'boards_post_replies')) |
|
23 | db.delete_table(db.shorten_name(u'boards_post_replies')) | |
30 |
|
24 | |||
31 |
|
25 | |||
32 | models = { |
|
26 | models = { | |
33 | u'boards.ban': { |
|
27 | u'boards.ban': { | |
34 | 'Meta': {'object_name': 'Ban'}, |
|
28 | 'Meta': {'object_name': 'Ban'}, | |
35 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
29 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
36 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}) |
|
30 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}) | |
37 | }, |
|
31 | }, | |
38 | u'boards.post': { |
|
32 | u'boards.post': { | |
39 | 'Meta': {'object_name': 'Post'}, |
|
33 | 'Meta': {'object_name': 'Post'}, | |
40 | '_text_rendered': ('django.db.models.fields.TextField', [], {}), |
|
34 | '_text_rendered': ('django.db.models.fields.TextField', [], {}), | |
41 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
35 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
42 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), |
|
36 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), | |
43 | 'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
37 | 'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |
44 | 'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), |
|
38 | 'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |
45 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
39 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |
46 | 'parent': ('django.db.models.fields.BigIntegerField', [], {}), |
|
40 | 'parent': ('django.db.models.fields.BigIntegerField', [], {}), | |
47 | 'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), |
|
41 | 'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |
48 | 'poster_user_agent': ('django.db.models.fields.TextField', [], {}), |
|
42 | 'poster_user_agent': ('django.db.models.fields.TextField', [], {}), | |
49 | 'pub_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
43 | 'pub_time': ('django.db.models.fields.DateTimeField', [], {}), | |
50 | 'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'re+'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['boards.Post']"}), |
|
44 | 'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'re+'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['boards.Post']"}), | |
51 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['boards.Tag']", 'symmetrical': 'False'}), |
|
45 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['boards.Tag']", 'symmetrical': 'False'}), | |
52 | 'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), |
|
46 | 'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), | |
53 | 'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}), |
|
47 | 'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}), | |
54 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}), |
|
48 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | |
55 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['boards.User']", 'null': 'True'}) |
|
49 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['boards.User']", 'null': 'True'}) | |
56 | }, |
|
50 | }, | |
57 | u'boards.setting': { |
|
51 | u'boards.setting': { | |
58 | 'Meta': {'object_name': 'Setting'}, |
|
52 | 'Meta': {'object_name': 'Setting'}, | |
59 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
53 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
60 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), |
|
54 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | |
61 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['boards.User']"}), |
|
55 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['boards.User']"}), | |
62 | 'value': ('django.db.models.fields.CharField', [], {'max_length': '50'}) |
|
56 | 'value': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |
63 | }, |
|
57 | }, | |
64 | u'boards.tag': { |
|
58 | u'boards.tag': { | |
65 | 'Meta': {'object_name': 'Tag'}, |
|
59 | 'Meta': {'object_name': 'Tag'}, | |
66 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
60 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
67 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) |
|
61 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) | |
68 | }, |
|
62 | }, | |
69 | u'boards.user': { |
|
63 | u'boards.user': { | |
70 | 'Meta': {'object_name': 'User'}, |
|
64 | 'Meta': {'object_name': 'User'}, | |
71 | 'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), |
|
65 | 'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |
72 | 'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['boards.Post']"}), |
|
66 | 'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['boards.Post']"}), | |
73 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
|
67 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
74 | 'last_access_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
68 | 'last_access_time': ('django.db.models.fields.DateTimeField', [], {}), | |
75 | 'rank': ('django.db.models.fields.IntegerField', [], {}), |
|
69 | 'rank': ('django.db.models.fields.IntegerField', [], {}), | |
76 | 'registration_time': ('django.db.models.fields.DateTimeField', [], {}), |
|
70 | 'registration_time': ('django.db.models.fields.DateTimeField', [], {}), | |
77 | 'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}) |
|
71 | 'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |
78 | } |
|
72 | } | |
79 | } |
|
73 | } | |
80 |
|
74 | |||
81 | complete_apps = ['boards'] No newline at end of file |
|
75 | complete_apps = ['boards'] |
General Comments 0
You need to be logged in to leave comments.
Login now