##// END OF EJS Templates
Added support for partial import: when the reply is imported but the original post is not, the reply will be connected after the original post is ready
Added support for partial import: when the reply is imported but the original post is not, the reply will be connected after the original post is ready

File last commit:

r1337:4c8c3ec5 default
r1588:b69fb396 default
Show More
0027_auto_20150912_1632.py
22 lines | 608 B | text/x-python | PythonLexer
/ boards / migrations / 0027_auto_20150912_1632.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
def build_opening_flag(apps, schema_editor):
Post = apps.get_model('boards', 'Post')
for post in Post.objects.all():
op = Post.objects.filter(threads__in=[post.thread]).order_by('pub_time').first()
post.opening = op.id == post.id
post.save(update_fields=['opening'])
dependencies = [
('boards', '0026_post_opening'),
]
operations = [
migrations.RunPython(build_opening_flag),
]