##// END OF EJS Templates
Compute divided range only once, do not expose it outsided of paginator
Compute divided range only once, do not expose it outsided of paginator

File last commit:

r1986:0b41439a default
r2063:5d000252 default
Show More
0009_post_thread.py
28 lines | 802 B | text/x-python | PythonLexer
neko259
Added field to hold the "main" thread. When connecting reflinks, connect...
r980 # -*- 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',
neko259
Adapt to django-2.0
r1986 field=models.ForeignKey(on_delete=models.CASCADE, related_name='pt+', to='boards.Thread', default=None, null=True),
neko259
Added field to hold the "main" thread. When connecting reflinks, connect...
r980 preserve_default=False,
),
migrations.RunPython(first_thread_to_thread),
]