3 from south.db import db
\r
4 from south.v2 import DataMigration
\r
5 from django.db import models
\r
6 from forum.migrations import ProgressBar
\r
8 class Migration(DataMigration):
\r
10 def forwards(self, orm):
\r
11 n_count = orm.Node.objects.count()
\r
12 print "\nConverting %s node states:" % n_count
\r
13 progress = ProgressBar(n_count)
\r
15 for n in orm.Node.objects.all():
\r
22 state_type = "deleted"
\r
29 action = orm.Action.objects.get(node=n, action_type="wikify")
\r
40 if n.node_type == "question" and n.extra_action:
\r
43 action = n.extra_action,
\r
44 state_type = "closed"
\r
49 if n.node_type == "answer" and n.extra_action:
\r
52 action = n.extra_action,
\r
53 state_type = "accepted"
\r
67 def backwards(self, orm):
\r
68 "Write your backwards methods here."
\r
72 'Meta': {'object_name': 'Group'},
\r
73 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
74 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
\r
75 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
\r
77 'auth.permission': {
\r
78 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
\r
79 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
\r
80 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
\r
81 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
82 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
\r
85 'Meta': {'object_name': 'User'},
\r
86 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
87 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
\r
88 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
\r
89 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
\r
90 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
91 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
92 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
93 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
94 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
95 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
\r
96 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
\r
97 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
\r
98 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
\r
100 'contenttypes.contenttype': {
\r
101 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
\r
102 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
\r
103 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
104 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
\r
105 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
\r
108 'Meta': {'object_name': 'Action'},
\r
109 'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
110 'action_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
\r
111 'canceled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
112 'canceled_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
\r
113 'canceled_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'canceled_actions'", 'null': 'True', 'to': "orm['forum.User']"}),
\r
114 'canceled_ip': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
\r
115 'extra': ('forum.models.utils.PickledObjectField', [], {'null': 'True'}),
\r
116 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
117 'ip': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
\r
118 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'null': 'True', 'to': "orm['forum.Node']"}),
\r
119 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'to': "orm['forum.User']"})
\r
121 'forum.actionrepute': {
\r
122 'Meta': {'object_name': 'ActionRepute'},
\r
123 'action': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reputes'", 'to': "orm['forum.Action']"}),
\r
124 'by_canceled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
125 'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
126 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
127 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reputes'", 'to': "orm['forum.User']"}),
\r
128 'value': ('django.db.models.fields.IntegerField', [], {'default': '0'})
\r
130 'forum.authkeyuserassociation': {
\r
131 'Meta': {'object_name': 'AuthKeyUserAssociation'},
\r
132 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
133 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
134 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
\r
135 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
\r
136 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['forum.User']"})
\r
139 'Meta': {'unique_together': "(('user', 'badge', 'node'),)", 'object_name': 'Award'},
\r
140 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'award'", 'unique': 'True', 'to': "orm['forum.Action']"}),
\r
141 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
142 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'awards'", 'to': "orm['forum.Badge']"}),
\r
143 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
144 'node': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Node']", 'null': 'True'}),
\r
145 'trigger': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'awards'", 'null': 'True', 'to': "orm['forum.Action']"}),
\r
146 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']"})
\r
149 'Meta': {'object_name': 'Badge'},
\r
150 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
\r
151 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'symmetrical': 'False', 'through': "orm['forum.Award']", 'to': "orm['forum.User']"}),
\r
152 'cls': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
\r
153 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
154 'type': ('django.db.models.fields.SmallIntegerField', [], {})
\r
157 'Meta': {'unique_together': "(('user', 'node'),)", 'object_name': 'Flag'},
\r
158 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'flag'", 'unique': 'True', 'to': "orm['forum.Action']"}),
\r
159 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
160 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
161 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flags'", 'to': "orm['forum.Node']"}),
\r
162 'reason': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
\r
163 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flags'", 'to': "orm['forum.User']"})
\r
165 'forum.keyvalue': {
\r
166 'Meta': {'object_name': 'KeyValue'},
\r
167 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
168 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
\r
169 'value': ('forum.models.utils.PickledObjectField', [], {'null': 'True'})
\r
171 'forum.markedtag': {
\r
172 'Meta': {'object_name': 'MarkedTag'},
\r
173 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
174 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
\r
175 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}),
\r
176 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['forum.User']"})
\r
179 'Meta': {'object_name': 'Node'},
\r
180 'abs_parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'all_children'", 'null': 'True', 'to': "orm['forum.Node']"}),
\r
181 'active_revision': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'active'", 'unique': 'True', 'null': 'True', 'to': "orm['forum.NodeRevision']"}),
\r
182 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
183 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nodes'", 'to': "orm['forum.User']"}),
\r
184 'body': ('django.db.models.fields.TextField', [], {}),
\r
185 'deleted': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'deleted_node'", 'unique': 'True', 'null': 'True', 'to': "orm['forum.Action']"}),
\r
186 'extra_action': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extra_node'", 'null': 'True', 'to': "orm['forum.Action']"}),
\r
187 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
\r
188 'extra_ref': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Node']", 'null': 'True'}),
\r
189 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
190 'in_moderation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'moderated_node'", 'unique': 'True', 'null': 'True', 'to': "orm['forum.Action']"}),
\r
191 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
\r
192 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']", 'null': 'True'}),
\r
193 'last_edited': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'edited_node'", 'unique': 'True', 'null': 'True', 'to': "orm['forum.Action']"}),
\r
194 'marked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
195 'node_type': ('django.db.models.fields.CharField', [], {'default': "'node'", 'max_length': '16'}),
\r
196 'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'children'", 'null': 'True', 'to': "orm['forum.Node']"}),
\r
197 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
\r
198 'state_string': ('django.db.models.fields.TextField', [], {'default': "''"}),
\r
199 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
\r
200 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'nodes'", 'symmetrical': 'False', 'to': "orm['forum.Tag']"}),
\r
201 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
\r
202 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
\r
204 'forum.noderevision': {
\r
205 'Meta': {'unique_together': "(('node', 'revision'),)", 'object_name': 'NodeRevision'},
\r
206 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'noderevisions'", 'to': "orm['forum.User']"}),
\r
207 'body': ('django.db.models.fields.TextField', [], {}),
\r
208 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
209 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Node']"}),
\r
210 'revised_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
211 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}),
\r
212 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
\r
213 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
\r
214 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'})
\r
216 'forum.nodestate': {
\r
217 'Meta': {'unique_together': "(('node', 'state_type'),)", 'object_name': 'NodeState'},
\r
218 'action': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'node_state'", 'unique': 'True', 'to': "orm['forum.Action']"}),
\r
219 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
220 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'state'", 'to': "orm['forum.Node']"}),
\r
221 'state_type': ('django.db.models.fields.CharField', [], {'max_length': '16'})
\r
223 'forum.openidassociation': {
\r
224 'Meta': {'object_name': 'OpenIdAssociation'},
\r
225 'assoc_type': ('django.db.models.fields.TextField', [], {'max_length': '64'}),
\r
226 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
\r
227 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
228 'issued': ('django.db.models.fields.IntegerField', [], {}),
\r
229 'lifetime': ('django.db.models.fields.IntegerField', [], {}),
\r
230 'secret': ('django.db.models.fields.TextField', [], {'max_length': '255'}),
\r
231 'server_url': ('django.db.models.fields.TextField', [], {'max_length': '2047'})
\r
233 'forum.openidnonce': {
\r
234 'Meta': {'object_name': 'OpenIdNonce'},
\r
235 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
236 'salt': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
\r
237 'server_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
\r
238 'timestamp': ('django.db.models.fields.IntegerField', [], {})
\r
240 'forum.questionsubscription': {
\r
241 'Meta': {'object_name': 'QuestionSubscription'},
\r
242 'auto_subscription': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
243 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
244 'last_view': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 5, 24, 12, 26, 33, 742000)'}),
\r
245 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Node']"}),
\r
246 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']"})
\r
248 'forum.subscriptionsettings': {
\r
249 'Meta': {'object_name': 'SubscriptionSettings'},
\r
250 'all_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
251 'all_questions_watched_tags': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
252 'enable_notifications': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
253 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
254 'member_joins': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1'}),
\r
255 'new_question': ('django.db.models.fields.CharField', [], {'default': "'d'", 'max_length': '1'}),
\r
256 'new_question_watched_tags': ('django.db.models.fields.CharField', [], {'default': "'i'", 'max_length': '1'}),
\r
257 'notify_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
258 'notify_answers': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
259 'notify_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
260 'notify_comments_own_post': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
261 'notify_reply_to_comments': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
262 'questions_answered': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
263 'questions_asked': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
\r
264 'questions_commented': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
265 'questions_viewed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
266 'subscribed_questions': ('django.db.models.fields.CharField', [], {'default': "'i'", 'max_length': '1'}),
\r
267 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'subscription_settings'", 'unique': 'True', 'to': "orm['forum.User']"})
\r
270 'Meta': {'object_name': 'Tag'},
\r
271 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['forum.User']"}),
\r
272 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
273 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
\r
274 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['forum.User']"}),
\r
275 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
276 'marked_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'marked_tags'", 'symmetrical': 'False', 'through': "orm['forum.MarkedTag']", 'to': "orm['forum.User']"}),
\r
277 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
\r
278 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
\r
281 'Meta': {'object_name': 'User', '_ormbases': ['auth.User']},
\r
282 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
\r
283 'bronze': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
\r
284 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
\r
285 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
286 'gold': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
\r
287 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
\r
288 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
\r
289 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
\r
290 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
\r
291 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
\r
292 'silver': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
\r
293 'subscriptions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'subscribers'", 'symmetrical': 'False', 'through': "orm['forum.QuestionSubscription']", 'to': "orm['forum.Node']"}),
\r
294 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
\r
295 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
\r
297 'forum.validationhash': {
\r
298 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'},
\r
299 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 5, 25, 12, 26, 33, 797000)'}),
\r
300 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
\r
301 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
302 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
\r
303 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
\r
304 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.User']"})
\r
307 'Meta': {'unique_together': "(('user', 'node'),)", 'object_name': 'Vote'},
\r
308 'action': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'vote'", 'unique': 'True', 'to': "orm['forum.Action']"}),
\r
309 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
\r
310 'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['forum.Node']"}),
\r
311 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['forum.User']"}),
\r
312 'value': ('django.db.models.fields.SmallIntegerField', [], {}),
\r
313 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'})
\r
317 complete_apps = ['forum']
\r