Skip to content

Commit

Permalink
Merge pull request #1471 from mkurek/fix/cmdb-sql-performance
Browse files Browse the repository at this point in the history
improved performance of CMDB CI view
  • Loading branch information
xliiv committed Jun 3, 2015
2 parents 0a335f3 + 69b3927 commit 299588f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ralph/cmdb/models_ci.py
Expand Up @@ -609,9 +609,19 @@ def __delete__(self, inst):
CI.technical_owners = CIOwnershipDescriptor(CIOwnershipType.technical.id)


class CIOwnerManager(models.Manager):
def get_query_set(self):
return super(CIOwnerManager, self).get_query_set().select_related(
'profile', 'profile__user'
)


class CIOwner(TimeTrackable, WithConcurrentGetOrCreate):
profile = models.OneToOneField('account.Profile', null=False)

objects = CIOwnerManager()
objects_raw = models.Manager()

def __unicode__(self):
return ' '.join([self.first_name, self.last_name])

Expand Down

0 comments on commit 299588f

Please sign in to comment.