Implement tower ui view url on models

This commit is contained in:
Matthew Jones
2016-02-23 14:19:42 -05:00
parent b88892be49
commit 75ef0dd395
8 changed files with 48 additions and 10 deletions

View File

@@ -5,6 +5,7 @@
import hmac
import json
import logging
from urlparse import urljoin
# Django
from django.conf import settings
@@ -139,6 +140,9 @@ class AdHocCommand(UnifiedJob):
def get_absolute_url(self):
return reverse('api:ad_hoc_command_detail', args=(self.pk,))
def get_ui_url(self):
return urljoin(tower_settings.TOWER_URL_BASE, "/#/ad_hoc_commands/{}".format(self.pk))
@property
def task_auth_token(self):
'''Return temporary auth token used for task requests via API.'''