mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-23 08:21:49 -05:00
Add common code for determining active (licensed) hosts with unique names, update licensing code and inventory import to use it. Implements https://trello.com/c/2Q9Mosks
This commit is contained in:
@@ -8,6 +8,14 @@ from django.db import models
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
class HostManager(models.Manager):
|
||||
"""Custom manager class for Hosts model."""
|
||||
|
||||
def active_count(self):
|
||||
"""Return count of active, unique hosts for licensing."""
|
||||
return self.filter(active=True, inventory__active=True).distinct('name').count()
|
||||
|
||||
|
||||
class InstanceManager(models.Manager):
|
||||
"""A custom manager class for the Instance model.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user