Show More
@@ -0,0 +1,87 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | from south.utils import datetime_utils as datetime | |||
|
3 | from south.db import db | |||
|
4 | from south.v2 import SchemaMigration | |||
|
5 | from django.db import models | |||
|
6 | ||||
|
7 | ||||
|
8 | class Migration(SchemaMigration): | |||
|
9 | ||||
|
10 | def forwards(self, orm): | |||
|
11 | # Deleting field 'Post.thread' | |||
|
12 | db.delete_column(u'boards_post', 'thread_id') | |||
|
13 | ||||
|
14 | ||||
|
15 | def backwards(self, orm): | |||
|
16 | # Adding field 'Post.thread' | |||
|
17 | db.add_column(u'boards_post', 'thread', | |||
|
18 | self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['boards.Post'], null=True), | |||
|
19 | keep_default=False) | |||
|
20 | ||||
|
21 | ||||
|
22 | models = { | |||
|
23 | 'boards.ban': { | |||
|
24 | 'Meta': {'object_name': 'Ban'}, | |||
|
25 | 'can_read': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | |||
|
26 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
27 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |||
|
28 | 'reason': ('django.db.models.fields.CharField', [], {'default': "'Auto'", 'max_length': '200'}) | |||
|
29 | }, | |||
|
30 | 'boards.post': { | |||
|
31 | 'Meta': {'ordering': "('id',)", 'object_name': 'Post'}, | |||
|
32 | '_text_rendered': ('django.db.models.fields.TextField', [], {}), | |||
|
33 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
34 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), | |||
|
35 | 'image_hash': ('django.db.models.fields.CharField', [], {'max_length': '36'}), | |||
|
36 | 'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
37 | 'image_pre_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
38 | 'image_pre_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
39 | 'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
40 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
41 | 'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |||
|
42 | 'poster_user_agent': ('django.db.models.fields.TextField', [], {}), | |||
|
43 | 'pub_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
44 | 'referenced_posts': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'rfp+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
45 | 'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), | |||
|
46 | 'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}), | |||
|
47 | 'thread_new': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Thread']", 'null': 'True'}), | |||
|
48 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}), | |||
|
49 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.User']", 'null': 'True'}) | |||
|
50 | }, | |||
|
51 | 'boards.setting': { | |||
|
52 | 'Meta': {'object_name': 'Setting'}, | |||
|
53 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
54 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | |||
|
55 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.User']"}), | |||
|
56 | 'value': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |||
|
57 | }, | |||
|
58 | 'boards.tag': { | |||
|
59 | 'Meta': {'ordering': "('name',)", 'object_name': 'Tag'}, | |||
|
60 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
61 | 'linked': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |||
|
62 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}), | |||
|
63 | 'threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tag+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Thread']"}) | |||
|
64 | }, | |||
|
65 | 'boards.thread': { | |||
|
66 | 'Meta': {'object_name': 'Thread'}, | |||
|
67 | 'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |||
|
68 | 'bump_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
69 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
70 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
71 | 'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tre+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
72 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['boards.Tag']", 'symmetrical': 'False'}) | |||
|
73 | }, | |||
|
74 | 'boards.user': { | |||
|
75 | 'Meta': {'object_name': 'User'}, | |||
|
76 | 'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |||
|
77 | 'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
78 | 'hidden_tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'ht+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Tag']"}), | |||
|
79 | 'hidden_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'hth+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
80 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
81 | 'rank': ('django.db.models.fields.IntegerField', [], {}), | |||
|
82 | 'registration_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
83 | 'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |||
|
84 | } | |||
|
85 | } | |||
|
86 | ||||
|
87 | complete_apps = ['boards'] No newline at end of file |
@@ -0,0 +1,88 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | from south.utils import datetime_utils as datetime | |||
|
3 | from south.db import db | |||
|
4 | from south.v2 import SchemaMigration | |||
|
5 | from django.db import models | |||
|
6 | ||||
|
7 | ||||
|
8 | class Migration(SchemaMigration): | |||
|
9 | ||||
|
10 | def forwards(self, orm): | |||
|
11 | # Adding field 'Post.refmap' | |||
|
12 | db.add_column(u'boards_post', 'refmap', | |||
|
13 | self.gf('django.db.models.fields.TextField')(null=True, blank=True), | |||
|
14 | keep_default=False) | |||
|
15 | ||||
|
16 | ||||
|
17 | def backwards(self, orm): | |||
|
18 | # Deleting field 'Post.refmap' | |||
|
19 | db.delete_column(u'boards_post', 'refmap') | |||
|
20 | ||||
|
21 | ||||
|
22 | models = { | |||
|
23 | 'boards.ban': { | |||
|
24 | 'Meta': {'object_name': 'Ban'}, | |||
|
25 | 'can_read': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | |||
|
26 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
27 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |||
|
28 | 'reason': ('django.db.models.fields.CharField', [], {'default': "'Auto'", 'max_length': '200'}) | |||
|
29 | }, | |||
|
30 | 'boards.post': { | |||
|
31 | 'Meta': {'ordering': "('id',)", 'object_name': 'Post'}, | |||
|
32 | '_text_rendered': ('django.db.models.fields.TextField', [], {}), | |||
|
33 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
34 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), | |||
|
35 | 'image_hash': ('django.db.models.fields.CharField', [], {'max_length': '36'}), | |||
|
36 | 'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
37 | 'image_pre_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
38 | 'image_pre_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
39 | 'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
40 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
41 | 'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |||
|
42 | 'poster_user_agent': ('django.db.models.fields.TextField', [], {}), | |||
|
43 | 'pub_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
44 | 'referenced_posts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'rfp+'", 'to': "orm['boards.Post']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True', 'db_index': 'True'}), | |||
|
45 | 'refmap': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), | |||
|
46 | 'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), | |||
|
47 | 'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}), | |||
|
48 | 'thread_new': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Thread']", 'null': 'True'}), | |||
|
49 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}), | |||
|
50 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.User']", 'null': 'True'}) | |||
|
51 | }, | |||
|
52 | 'boards.setting': { | |||
|
53 | 'Meta': {'object_name': 'Setting'}, | |||
|
54 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
55 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | |||
|
56 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.User']"}), | |||
|
57 | 'value': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |||
|
58 | }, | |||
|
59 | 'boards.tag': { | |||
|
60 | 'Meta': {'ordering': "('name',)", 'object_name': 'Tag'}, | |||
|
61 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
62 | 'linked': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |||
|
63 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}), | |||
|
64 | 'threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tag+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Thread']"}) | |||
|
65 | }, | |||
|
66 | 'boards.thread': { | |||
|
67 | 'Meta': {'object_name': 'Thread'}, | |||
|
68 | 'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |||
|
69 | 'bump_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
70 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
71 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
72 | 'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tre+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
73 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['boards.Tag']", 'symmetrical': 'False'}) | |||
|
74 | }, | |||
|
75 | 'boards.user': { | |||
|
76 | 'Meta': {'object_name': 'User'}, | |||
|
77 | 'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |||
|
78 | 'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
79 | 'hidden_tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'ht+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Tag']"}), | |||
|
80 | 'hidden_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'hth+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
81 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
82 | 'rank': ('django.db.models.fields.IntegerField', [], {}), | |||
|
83 | 'registration_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
84 | 'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |||
|
85 | } | |||
|
86 | } | |||
|
87 | ||||
|
88 | complete_apps = ['boards'] No newline at end of file |
@@ -0,0 +1,91 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | from south.utils import datetime_utils as datetime | |||
|
3 | from south.db import db | |||
|
4 | from south.v2 import DataMigration | |||
|
5 | from django.db import models | |||
|
6 | ||||
|
7 | from boards.models import Post | |||
|
8 | ||||
|
9 | class Migration(DataMigration): | |||
|
10 | ||||
|
11 | ||||
|
12 | def forwards(self, orm): | |||
|
13 | "Write your forwards methods here." | |||
|
14 | # Note: Don't use "from appname.models import ModelName". | |||
|
15 | # Use orm.ModelName to refer to models in this application, | |||
|
16 | # and orm['appname.ModelName'] for models in other applications. | |||
|
17 | for post in Post.objects.all(): | |||
|
18 | post.build_refmap() | |||
|
19 | post.save() | |||
|
20 | ||||
|
21 | def backwards(self, orm): | |||
|
22 | "Write your backwards methods here." | |||
|
23 | ||||
|
24 | models = { | |||
|
25 | 'boards.ban': { | |||
|
26 | 'Meta': {'object_name': 'Ban'}, | |||
|
27 | 'can_read': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | |||
|
28 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
29 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |||
|
30 | 'reason': ('django.db.models.fields.CharField', [], {'default': "'Auto'", 'max_length': '200'}) | |||
|
31 | }, | |||
|
32 | 'boards.post': { | |||
|
33 | 'Meta': {'ordering': "('id',)", 'object_name': 'Post'}, | |||
|
34 | '_text_rendered': ('django.db.models.fields.TextField', [], {}), | |||
|
35 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
36 | 'image': ('boards.thumbs.ImageWithThumbsField', [], {'max_length': '100', 'blank': 'True'}), | |||
|
37 | 'image_hash': ('django.db.models.fields.CharField', [], {'max_length': '36'}), | |||
|
38 | 'image_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
39 | 'image_pre_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
40 | 'image_pre_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
41 | 'image_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | |||
|
42 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
43 | 'poster_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | |||
|
44 | 'poster_user_agent': ('django.db.models.fields.TextField', [], {}), | |||
|
45 | 'pub_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
46 | 'referenced_posts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'rfp+'", 'to': "orm['boards.Post']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True', 'db_index': 'True'}), | |||
|
47 | 'refmap': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), | |||
|
48 | 'text': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), | |||
|
49 | 'text_markup_type': ('django.db.models.fields.CharField', [], {'default': "'markdown'", 'max_length': '30'}), | |||
|
50 | 'thread_new': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.Thread']", 'null': 'True'}), | |||
|
51 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}), | |||
|
52 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['boards.User']", 'null': 'True'}) | |||
|
53 | }, | |||
|
54 | 'boards.setting': { | |||
|
55 | 'Meta': {'object_name': 'Setting'}, | |||
|
56 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
57 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | |||
|
58 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.User']"}), | |||
|
59 | 'value': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |||
|
60 | }, | |||
|
61 | 'boards.tag': { | |||
|
62 | 'Meta': {'ordering': "('name',)", 'object_name': 'Tag'}, | |||
|
63 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
64 | 'linked': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |||
|
65 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}), | |||
|
66 | 'threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tag+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Thread']"}) | |||
|
67 | }, | |||
|
68 | 'boards.thread': { | |||
|
69 | 'Meta': {'object_name': 'Thread'}, | |||
|
70 | 'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |||
|
71 | 'bump_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
72 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
73 | 'last_edit_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
74 | 'replies': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tre+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
75 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['boards.Tag']", 'symmetrical': 'False'}) | |||
|
76 | }, | |||
|
77 | 'boards.user': { | |||
|
78 | 'Meta': {'object_name': 'User'}, | |||
|
79 | 'fav_tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['boards.Tag']", 'null': 'True', 'blank': 'True'}), | |||
|
80 | 'fav_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
81 | 'hidden_tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'ht+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Tag']"}), | |||
|
82 | 'hidden_threads': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'hth+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['boards.Post']"}), | |||
|
83 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
|
84 | 'rank': ('django.db.models.fields.IntegerField', [], {}), | |||
|
85 | 'registration_time': ('django.db.models.fields.DateTimeField', [], {}), | |||
|
86 | 'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |||
|
87 | } | |||
|
88 | } | |||
|
89 | ||||
|
90 | complete_apps = ['boards'] | |||
|
91 | symmetrical = True |
@@ -156,6 +156,7 b' class PostManager(models.Manager):' | |||||
156 | referenced_post = ref_post[0] |
|
156 | referenced_post = ref_post[0] | |
157 | referenced_post.referenced_posts.add(post) |
|
157 | referenced_post.referenced_posts.add(post) | |
158 | referenced_post.last_edit_time = post.pub_time |
|
158 | referenced_post.last_edit_time = post.pub_time | |
|
159 | referenced_post.build_refmap() | |||
159 | referenced_post.save() |
|
160 | referenced_post.save() | |
160 |
|
161 | |||
161 | referenced_thread = referenced_post.get_thread() |
|
162 | referenced_thread = referenced_post.get_thread() | |
@@ -246,6 +247,7 b' class Post(models.Model):' | |||||
246 | null=True, |
|
247 | null=True, | |
247 | blank=True, related_name='rfp+', |
|
248 | blank=True, related_name='rfp+', | |
248 | db_index=True) |
|
249 | db_index=True) | |
|
250 | refmap = models.TextField(null=True, blank=True) | |||
249 |
|
251 | |||
250 | def __unicode__(self): |
|
252 | def __unicode__(self): | |
251 | return '#' + str(self.id) + ' ' + self.title + ' (' + \ |
|
253 | return '#' + str(self.id) + ' ' + self.title + ' (' + \ | |
@@ -262,11 +264,23 b' class Post(models.Model):' | |||||
262 |
|
264 | |||
263 | return title |
|
265 | return title | |
264 |
|
266 | |||
|
267 | def build_refmap(self): | |||
|
268 | map_string = '' | |||
|
269 | ||||
|
270 | first = True | |||
|
271 | for refpost in self.referenced_posts.all(): | |||
|
272 | if not first: | |||
|
273 | map_string += ', ' | |||
|
274 | map_string += '<a href="%s">>>%s</a>' % (refpost.get_url(), refpost.id) | |||
|
275 | first = False | |||
|
276 | ||||
|
277 | self.refmap = map_string | |||
|
278 | ||||
265 | def get_sorted_referenced_posts(self): |
|
279 | def get_sorted_referenced_posts(self): | |
266 |
return self.ref |
|
280 | return self.refmap | |
267 |
|
281 | |||
268 | def is_referenced(self): |
|
282 | def is_referenced(self): | |
269 |
return self.ref |
|
283 | return len(self.refmap) > 0 | |
270 |
|
284 | |||
271 | def is_opening(self): |
|
285 | def is_opening(self): | |
272 | """ |
|
286 | """ | |
@@ -416,8 +430,7 b' class Thread(models.Model):' | |||||
416 | reply_count - 1) |
|
430 | reply_count - 1) | |
417 | last_replies = self.replies.order_by( |
|
431 | last_replies = self.replies.order_by( | |
418 | 'pub_time').defer('image_hash', 'poster_user_agent', |
|
432 | 'pub_time').defer('image_hash', 'poster_user_agent', | |
419 |
'text_markup_type') |
|
433 | 'text_markup_type')[ | |
420 | .prefetch_related('referenced_posts')[ |
|
|||
421 | reply_count - reply_count_to_show:] |
|
434 | reply_count - reply_count_to_show:] | |
422 |
|
435 | |||
423 | return last_replies |
|
436 | return last_replies | |
@@ -440,7 +453,7 b' class Thread(models.Model):' | |||||
440 | if view_fields_only: |
|
453 | if view_fields_only: | |
441 | query = query.defer( |
|
454 | query = query.defer( | |
442 | 'image_hash', 'poster_user_agent', 'text_markup_type') |
|
455 | 'image_hash', 'poster_user_agent', 'text_markup_type') | |
443 | return query.all().prefetch_related('referenced_posts') |
|
456 | return query.all() | |
444 |
|
457 | |||
445 | def add_tag(self, tag): |
|
458 | def add_tag(self, tag): | |
446 | """ |
|
459 | """ |
@@ -68,12 +68,11 b'' | |||||
68 | {{ post.text.rendered }} |
|
68 | {{ post.text.rendered }} | |
69 | {% endif %} |
|
69 | {% endif %} | |
70 | {% endautoescape %} |
|
70 | {% endautoescape %} | |
71 |
{% if post.referenced |
|
71 | {% if post.is_referenced %} | |
72 | <div class="refmap"> |
|
72 | <div class="refmap"> | |
73 |
{% |
|
73 | {% autoescape off %} | |
74 |
|
|
74 | {% trans "Replies" %}: {{ post.refmap }} | |
75 | <a href="{% post_object_url ref_post thread=thread %}">>>{{ ref_post.id }}</a>{% if not forloop.last %},{% endif %} |
|
75 | {% endautoescape %} | |
76 | {% endfor %} |
|
|||
77 | </div> |
|
76 | </div> | |
78 | {% endif %} |
|
77 | {% endif %} | |
79 | </div> |
|
78 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now