allow changing source_project

* scm project backed inventory now allows source_project to be mutated.
We reset the tracked revision when this happens.
This commit is contained in:
Chris Meyers 2017-06-07 15:37:51 -04:00
parent fe499c0dca
commit 2317687468

View File

@ -1615,7 +1615,7 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt
def build_relational_field(self, field_name, relation_info):
field_class, field_kwargs = super(InventorySourceSerializer, self).build_relational_field(field_name, relation_info)
# SCM Project and inventory are read-only unless creating a new inventory.
if self.instance and field_name in ['source_project', 'inventory']:
if self.instance and field_name in ['inventory',]:
field_kwargs['read_only'] = True
field_kwargs.pop('queryset', None)
return field_class, field_kwargs