1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

better insights_credential reverse relationship

* From an insights cred, access all related inventories via
cred.insights_inventories rather than cred.insights_credential
* This fixes auto-attaching insights_credential to credential summary
fields. Fixes by NOT attaching them. That is the desired behavior.
This commit is contained in:
Chris Meyers 2017-06-05 13:43:09 -04:00
parent e1a0eec29f
commit 0d56f42c83
2 changed files with 2 additions and 2 deletions

View File

@ -269,7 +269,7 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='inventory', model_name='inventory',
name='insights_credential', name='insights_credential',
field=models.ForeignKey(related_name='insights_credential', default=None, blank=True, on_delete=models.deletion.SET_NULL, to='main.Credential', help_text='Credentials to be used by hosts belonging to this inventory when accessing Red Hat Insights API.', null=True), field=models.ForeignKey(related_name='insights_inventories', on_delete=models.deletion.SET_NULL, default=None, blank=True, to='main.Credential', help_text='Credentials to be used by hosts belonging to this inventory when accessing Red Hat Insights API.', null=True),
), ),
migrations.AlterField( migrations.AlterField(
model_name='inventory', model_name='inventory',

View File

@ -146,7 +146,7 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin):
]) ])
insights_credential = models.ForeignKey( insights_credential = models.ForeignKey(
'Credential', 'Credential',
related_name='insights_credential', related_name='insights_inventories',
help_text=_('Credentials to be used by hosts belonging to this inventory when accessing Red Hat Insights API.'), help_text=_('Credentials to be used by hosts belonging to this inventory when accessing Red Hat Insights API.'),
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True, blank=True,