mirror of
https://github.com/QingdaoU/Spirit.git
synced 2025-01-17 01:57:54 +00:00
comment.migration re-render all comments
This commit is contained in:
parent
dd7676193d
commit
6ee3ce10ea
28
spirit/comment/migrations/0003_auto_20151115_0400.py
Normal file
28
spirit/comment/migrations/0003_auto_20151115_0400.py
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
# todo: remove in Spirit 0.5
|
||||
|
||||
def render_comments(apps, schema_editor):
|
||||
# This is due to a changes in the emoji renderer (images -> css) and no-follow links
|
||||
from ...core.utils.markdown import Markdown
|
||||
|
||||
Comment = apps.get_model("spirit_comment", "Comment")
|
||||
|
||||
for comment in Comment.objects.all():
|
||||
comment.comment_html = Markdown().render(comment.comment)
|
||||
comment.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('spirit_comment', '0002_auto_20150828_2003'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(render_comments),
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user