##// END OF EJS Templates
Don't run time conversion if Intl not available in browser. Also convert...
Don't run time conversion if Intl not available in browser. Also convert thread death time in archived threads

File last commit:

r980:3fbf1166 default
r1023:0040ea34 default
Show More
0009_post_thread.py
28 lines | 776 B | text/x-python | PythonLexer
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
def first_thread_to_thread(apps, schema_editor):
Post = apps.get_model('boards', 'Post')
for post in Post.objects.all():
post.thread = post.threads.first()
post.save(update_fields=['thread'])
dependencies = [
('boards', '0008_auto_20150205_1304'),
]
operations = [
migrations.AddField(
model_name='post',
name='thread',
field=models.ForeignKey(related_name='pt+', to='boards.Thread', default=None, null=True),
preserve_default=False,
),
migrations.RunPython(first_thread_to_thread),
]