3 from south.db import db
4 from south.v2 import DataMigration
5 from django.db import models
6 from forum.migrations import ProgressBar
9 from django.utils.safestring import mark_safe
10 from django.utils.html import strip_tags
11 from forum.utils.html import sanitize_html
13 class Migration(DataMigration):
15 def forwards(self, orm):
16 count = orm.Node.objects.count()
17 progress = ProgressBar(count)
19 for node in orm.Node.objects.all():
20 node.body = mark_safe(sanitize_html(markdown.markdown(node.body)))
24 def backwards(self, orm):
25 "Write your backwards methods here."
30 'Meta': {'object_name': 'Group'},
31 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
32 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
33 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
36 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
37 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
38 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
39 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
40 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
43 'Meta': {'object_name': 'User'},
44 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
45 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
46 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
47 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
48 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
49 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
50 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
51 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
52 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
53 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
54 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
55 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
56 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
58 'contenttypes.contenttype': {
59 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
60 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
61 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
62 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
63 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
66 'Meta': {'object_name': 'Action'},
67 'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
68 'action_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
69 'canceled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
70 'canceled_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
71 'canceled_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'canceled_actions'", 'null': 'True', 'to': "orm['forum.User']"}),
72 'canceled_ip': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
73 'extra': ('forum.models.utils.PickledObjectField', [], {'null': 'True'}),
74 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
75 'ip': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
76 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'null': 'True', 'to': "orm['forum.Node']"}),
77 'real_user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'proxied_actions'", 'null': 'True', 'to': "orm['forum.User']"}),
78 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'to': "orm['forum.User']"})
80 'forum.actionrepute': {
81 'Meta': {'object_name': 'ActionRepute'},
82 'action': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reputes'", 'to': "orm['forum.Action']"}),
83 'by_canceled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
84 'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
85 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
86 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reputes'", 'to': "orm['forum.User']"}),
87 'value': ('django.db.models.fields.IntegerField', [], {'default': '0'})
89 'forum.authkeyuserassociation': {
90 'Meta': {'object_name': 'AuthKeyUserAssociation'},
91 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
92 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
93 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
94 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
95 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['forum.User']"})
98 'Meta': {'unique_together': "(('user', 'badge', 'node'),)", 'object_name': 'Award'},
99 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'award'", 'unique': 'True', 'to': "orm['forum.Action']"}),
100 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
101 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'awards'", 'to': "orm['forum.Badge']"}),
102 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
103 'node': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Node']", 'null': 'True'}),
104 'trigger': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'awards'", 'null': 'True', 'to': "orm['forum.Action']"}),
105 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']"})
108 'Meta': {'object_name': 'Badge'},
109 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
110 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'symmetrical': 'False', 'through': "orm['forum.Award']", 'to': "orm['forum.User']"}),
111 'cls': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
112 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
113 'type': ('django.db.models.fields.SmallIntegerField', [], {})
116 'Meta': {'unique_together': "(('user', 'node'),)", 'object_name': 'Flag'},
117 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'flag'", 'unique': 'True', 'to': "orm['forum.Action']"}),
118 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
119 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
120 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flags'", 'to': "orm['forum.Node']"}),
121 'reason': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
122 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flags'", 'to': "orm['forum.User']"})
125 'Meta': {'object_name': 'KeyValue'},
126 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
127 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
128 'value': ('forum.models.utils.PickledObjectField', [], {'null': 'True'})
131 'Meta': {'object_name': 'MarkedTag'},
132 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
133 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
134 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}),
135 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['forum.User']"})
138 'Meta': {'object_name': 'Node'},
139 'abs_parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'all_children'", 'null': 'True', 'to': "orm['forum.Node']"}),
140 'active_revision': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'active'", 'unique': 'True', 'null': 'True', 'to': "orm['forum.NodeRevision']"}),
141 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
142 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nodes'", 'to': "orm['forum.User']"}),
143 'body': ('django.db.models.fields.TextField', [], {}),
144 'extra': ('forum.models.utils.PickledObjectField', [], {'null': 'True'}),
145 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
146 'extra_ref': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Node']", 'null': 'True'}),
147 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
148 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
149 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']", 'null': 'True'}),
150 'last_edited': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'edited_node'", 'unique': 'True', 'null': 'True', 'to': "orm['forum.Action']"}),
151 'marked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
152 'node_type': ('django.db.models.fields.CharField', [], {'default': "'node'", 'max_length': '16'}),
153 'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'children'", 'null': 'True', 'to': "orm['forum.Node']"}),
154 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
155 'state_string': ('django.db.models.fields.TextField', [], {'default': "''"}),
156 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
157 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'nodes'", 'symmetrical': 'False', 'to': "orm['forum.Tag']"}),
158 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'})
160 'forum.noderevision': {
161 'Meta': {'unique_together': "(('node', 'revision'),)", 'object_name': 'NodeRevision'},
162 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'noderevisions'", 'to': "orm['forum.User']"}),
163 'body': ('django.db.models.fields.TextField', [], {}),
164 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
165 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Node']"}),
166 'revised_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
167 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}),
168 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
169 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
170 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'})
173 'Meta': {'unique_together': "(('node', 'state_type'),)", 'object_name': 'NodeState'},
174 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'node_state'", 'unique': 'True', 'to': "orm['forum.Action']"}),
175 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
176 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'states'", 'to': "orm['forum.Node']"}),
177 'state_type': ('django.db.models.fields.CharField', [], {'max_length': '16'})
179 'forum.questionsubscription': {
180 'Meta': {'object_name': 'QuestionSubscription'},
181 'auto_subscription': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
182 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
183 'last_view': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 12, 22, 17, 54, 20, 862306)'}),
184 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Node']"}),
185 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']"})
187 'forum.subscriptionsettings': {
188 'Meta': {'object_name': 'SubscriptionSettings'},
189 'all_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
190 'all_questions_watched_tags': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
191 'enable_notifications': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
192 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
193 'member_joins': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1'}),
194 'new_question': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1'}),
195 'new_question_watched_tags': ('django.db.models.fields.CharField', [], {'default': "'i'", 'max_length': '1'}),
196 'notify_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
197 'notify_answers': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
198 'notify_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
199 'notify_comments_own_post': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
200 'notify_reply_to_comments': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
201 'questions_answered': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
202 'questions_asked': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
203 'questions_commented': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
204 'questions_viewed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
205 'send_digest': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
206 'subscribed_questions': ('django.db.models.fields.CharField', [], {'default': "'i'", 'max_length': '1'}),
207 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'subscription_settings'", 'unique': 'True', 'to': "orm['forum.User']"})
210 'Meta': {'object_name': 'Tag'},
211 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['forum.User']"}),
212 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
213 'marked_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'marked_tags'", 'symmetrical': 'False', 'through': "orm['forum.MarkedTag']", 'to': "orm['forum.User']"}),
214 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
215 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
218 'Meta': {'object_name': 'User', '_ormbases': ['auth.User']},
219 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
220 'bronze': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
221 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
222 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
223 'gold': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
224 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
225 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
226 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
227 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
228 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
229 'silver': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
230 'subscriptions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'subscribers'", 'symmetrical': 'False', 'through': "orm['forum.QuestionSubscription']", 'to': "orm['forum.Node']"}),
231 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
232 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
234 'forum.userproperty': {
235 'Meta': {'unique_together': "(('user', 'key'),)", 'object_name': 'UserProperty'},
236 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
237 'key': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
238 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'properties'", 'to': "orm['forum.User']"}),
239 'value': ('forum.models.utils.PickledObjectField', [], {'null': 'True'})
241 'forum.validationhash': {
242 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'},
243 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 12, 23, 17, 54, 20, 937539)'}),
244 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
245 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
246 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
247 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
248 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']"})
251 'Meta': {'unique_together': "(('user', 'node'),)", 'object_name': 'Vote'},
252 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'vote'", 'unique': 'True', 'to': "orm['forum.Action']"}),
253 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
254 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['forum.Node']"}),
255 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['forum.User']"}),
256 'value': ('django.db.models.fields.SmallIntegerField', [], {}),
257 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'})
261 complete_apps = ['forum']