From f471f9b0720fd12db1cc6e6a5e827cf978752dbb Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Fri, 8 Apr 2016 12:30:57 -0400 Subject: [PATCH] change migration to allow blank inventory field --- .../migrations/0014_v300_job_prompt_for_fields.py | 11 +++++++++++ awx/main/models/jobs.py | 2 ++ 2 files changed, 13 insertions(+) diff --git a/awx/main/migrations/0014_v300_job_prompt_for_fields.py b/awx/main/migrations/0014_v300_job_prompt_for_fields.py index 68bb315b9a..e7e5a5b623 100644 --- a/awx/main/migrations/0014_v300_job_prompt_for_fields.py +++ b/awx/main/migrations/0014_v300_job_prompt_for_fields.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion from django.conf import settings @@ -32,4 +33,14 @@ class Migration(migrations.Migration): name='ask_tags_on_launch', field=models.BooleanField(default=False), ), + migrations.AlterField( + model_name='job', + name='inventory', + field=models.ForeignKey(related_name='jobs', on_delete=django.db.models.deletion.SET_NULL, default=None, blank=True, to='main.Inventory', null=True), + ), + migrations.AlterField( + model_name='jobtemplate', + name='inventory', + field=models.ForeignKey(related_name='jobtemplates', on_delete=django.db.models.deletion.SET_NULL, default=None, blank=True, to='main.Inventory', null=True), + ), ] diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 4d4c321d5e..ba584a6eb6 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -53,7 +53,9 @@ class JobOptions(BaseModel): inventory = models.ForeignKey( 'Inventory', related_name='%(class)ss', + blank=True, null=True, + default=None, on_delete=models.SET_NULL, ) project = models.ForeignKey(