kopia lustrzana https://github.com/OpenDroneMap/WebODM
Update images_count field migration
rodzic
b1f6788057
commit
fddce6ee29
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.1 on 2017-07-07 18:05
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def update_images_count(apps, schema_editor):
|
||||
Task = apps.get_model('app', 'Task')
|
||||
|
||||
for t in Task.objects.all():
|
||||
print("Updating {}".format(t))
|
||||
t.images_count = t.imageupload_set.count()
|
||||
t.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('app', '0025_auto_20190220_1854'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_images_count),
|
||||
]
|
Ładowanie…
Reference in New Issue