##// END OF EJS Templates
If thread is specified in the post template, do not load it again
If thread is specified in the post template, do not load it again

File last commit:

r1360:94773499 merge decentral
r1670:c9facaf1 default
Show More
0025_auto_20150825_2049.py
28 lines | 850 B | text/x-python | PythonLexer
/ boards / migrations / 0025_auto_20150825_2049.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
def rebuild_refmap(apps, schema_editor):
Post = apps.get_model('boards', 'Post')
for post in Post.objects.all():
refposts = list()
for refpost in post.referenced_posts.all():
result = '<a href="{}">&gt;&gt;{}</a>'.format(refpost.get_absolute_url(),
self.id)
if refpost.is_opening():
result = '<b>{}</b>'.format(result)
refposts += result
post.refmap = ', '.join(refposts)
post.save(update_fields=['refmap'])
dependencies = [
('boards', '0024_post_tripcode'),
]
operations = [
migrations.RunPython(rebuild_refmap),
]