##// END OF EJS Templates
Do not try to add an attachment ref for external attachment if there is an internal and external attachment in the same post
Do not try to add an attachment ref for external attachment if there is an internal and external attachment in the same post

File last commit:

r979:34912b48 default
r1839:4c8bff54 default
Show More
0007_auto_20150205_1247.py
30 lines | 781 B | text/x-python | PythonLexer
/ boards / migrations / 0007_auto_20150205_1247.py
neko259
Allow connecting post to many threads
r979 # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
def thread_to_threads(apps, schema_editor):
Post = apps.get_model('boards', 'Post')
for post in Post.objects.all():
post.threads.add(post.thread_new)
dependencies = [
('boards', '0006_auto_20150201_2130'),
]
operations = [
migrations.AddField(
model_name='post',
name='threads',
field=models.ManyToManyField(to='boards.Thread'),
preserve_default=True,
),
migrations.RunPython(thread_to_threads),
migrations.RemoveField(
model_name='post',
name='thread_new',
),
]