-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added segment_size field to Task model.
- Loading branch information
Nikita Manovich
committed
Jan 25, 2019
1 parent
e6bbe22
commit 8700940
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 2.1.5 on 2019-01-25 08:35 | ||
|
||
from django.db import migrations, models | ||
|
||
def set_segment_size(apps, schema_editor): | ||
Task = apps.get_model('engine', 'Task') | ||
for task in Task.objects.all(): | ||
segment = task.segment_set.first() | ||
task.segment_size = segment.stop_frame - segment.start_frame + 1 | ||
task.save() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('engine', '0014_job_max_shape_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='task', | ||
name='segment_size', | ||
field=models.PositiveIntegerField(null=True), | ||
), | ||
migrations.RunPython(code=set_segment_size, | ||
reverse_code=migrations.RunPython.noop), | ||
|
||
migrations.AlterField( | ||
model_name='task', | ||
name='segment_size', | ||
field=models.PositiveIntegerField(), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters