mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
c11b433d94
- Builds can have child builds
56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
# Generated by Django 3.0.5 on 2020-04-25 05:07
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import mptt.fields
|
|
from build.models import Build
|
|
|
|
|
|
def update_tree(apps, schema_editor):
|
|
# Update the Build MPTT model
|
|
Build.objects.rebuild()
|
|
|
|
|
|
def nupdate_tree(apps, schema_editor):
|
|
pass
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('build', '0012_build_sales_order'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='build',
|
|
name='level',
|
|
field=models.PositiveIntegerField(default=0, editable=False),
|
|
preserve_default=False,
|
|
),
|
|
migrations.AddField(
|
|
model_name='build',
|
|
name='lft',
|
|
field=models.PositiveIntegerField(default=0, editable=False),
|
|
preserve_default=False,
|
|
),
|
|
migrations.AddField(
|
|
model_name='build',
|
|
name='parent',
|
|
field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='children', to='build.Build'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='build',
|
|
name='rght',
|
|
field=models.PositiveIntegerField(default=0, editable=False),
|
|
preserve_default=False,
|
|
),
|
|
migrations.AddField(
|
|
model_name='build',
|
|
name='tree_id',
|
|
field=models.PositiveIntegerField(db_index=True, default=0, editable=False),
|
|
preserve_default=False,
|
|
),
|
|
migrations.RunPython(update_tree, reverse_code=nupdate_tree),
|
|
]
|