Builds can only be made for active parts

This commit is contained in:
Oliver Walters 2019-05-05 22:34:14 +10:00
parent b85a4d0895
commit 9bbcc35959
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2 on 2019-05-05 12:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('build', '0009_build_completed_by'),
]
operations = [
migrations.AlterField(
model_name='build',
name='part',
field=models.ForeignKey(limit_choices_to={'active': True, 'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part'),
),
]

View File

@ -84,7 +84,10 @@ class Build(models.Model):
part = models.ForeignKey('part.Part', on_delete=models.CASCADE, part = models.ForeignKey('part.Part', on_delete=models.CASCADE,
related_name='builds', related_name='builds',
limit_choices_to={'buildable': True}, limit_choices_to={
'buildable': True,
'active': True
},
) )
title = models.CharField( title = models.CharField(