Adding organization reference to the custom inventory script

This commit is contained in:
Matthew Jones
2014-12-03 15:05:26 -05:00
parent 9a90277e5e
commit 19c0d04885
4 changed files with 14 additions and 2 deletions

View File

@@ -1235,6 +1235,7 @@ class CustomInventoryScript(CommonModel):
class Meta:
app_label = 'main'
unique_together = [('name', 'organization')]
ordering = ('name',)
script = models.TextField(
@@ -1242,6 +1243,12 @@ class CustomInventoryScript(CommonModel):
default='',
help_text=_('Inventory script contents'),
)
organization = models.ForeignKey(
'Organization',
related_name='custom_inventory_scripts',
help_text=_('Organization owning this inventory script'),
on_delete=models.CASCADE,
)
def get_absolute_url(self):
return reverse('api:inventory_script_detail', args=(self.pk,))