diff options
author | Aaron Tan <jangsutsr@gmail.com> | 2017-05-30 23:00:27 +0200 |
---|---|---|
committer | Aaron Tan <jangsutsr@gmail.com> | 2017-05-30 23:00:27 +0200 |
commit | 604243428c8bee126167e93941f09e2cfca0c1f8 (patch) | |
tree | 437286e20f8d81eb5e04cbf4f17dd7f6063888e9 /awx/main/models/ha.py | |
parent | fix variable setup for certain inventory source types (diff) | |
download | awx-604243428c8bee126167e93941f09e2cfca0c1f8.tar.xz awx-604243428c8bee126167e93941f09e2cfca0c1f8.zip |
Add URL and type fields to instances/instance groups.
Diffstat (limited to '')
-rw-r--r-- | awx/main/models/ha.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/awx/main/models/ha.py b/awx/main/models/ha.py index 00c22343f9..1456b68d2b 100644 --- a/awx/main/models/ha.py +++ b/awx/main/models/ha.py @@ -8,6 +8,7 @@ from django.utils.translation import ugettext_lazy as _ from solo.models import SingletonModel +from awx.api.versioning import reverse from awx.main.managers import InstanceManager from awx.main.models.inventory import InventoryUpdate from awx.main.models.jobs import Job @@ -34,6 +35,9 @@ class Instance(models.Model): class Meta: app_label = 'main' + def get_absolute_url(self, request=None): + return reverse('api:instance_detail', kwargs={'pk': self.pk}, request=request) + @property def consumed_capacity(self): return sum(x.task_impact for x in UnifiedJob.objects.filter(execution_node=self.hostname, @@ -57,6 +61,9 @@ class InstanceGroup(models.Model): help_text=_('Instances that are members of this InstanceGroup'), ) + def get_absolute_url(self, request=None): + return reverse('api:instance_group_detail', kwargs={'pk': self.pk}, request=request) + @property def capacity(self): return sum([x[0] for x in self.instances.values_list('capacity')]) |