From: Scott Baker Date: Wed, 7 May 2014 16:04:07 +0000 (-0700) Subject: add account computed field to contentprovider X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7a0907602fd5304d30913e2616c665bc7b658d94;p=plstackapi.git add account computed field to contentprovider --- diff --git a/planetstack/hpc/models.py b/planetstack/hpc/models.py index 1b80cc6..2980ce7 100644 --- a/planetstack/hpc/models.py +++ b/planetstack/hpc/models.py @@ -28,6 +28,10 @@ class ContentProvider(PlCoreBase): class Meta: app_label = "hpc" + # legacy vicci content providers already have names. + CP_TO_ACCOUNT = {"ON.LAB": "onlabcp", + "Syndicate": "syndicatecp"} + content_provider_id = models.IntegerField(null=True, blank=True) name = models.CharField(max_length=254) enabled = models.BooleanField(default=True) @@ -39,6 +43,10 @@ class ContentProvider(PlCoreBase): def __unicode__(self): return u'%s' % (self.name) + @property + def account(self): + return self.CP_TO_ACCOUNT.get(self.name, self.name) + class OriginServer(PlCoreBase): class Meta: app_label = "hpc"