Show if the key is active on the corp list

This commit is contained in:
2011-08-31 11:21:07 +01:00
parent 679d664755
commit eb4bf84c01
2 changed files with 10 additions and 4 deletions

View File

@@ -70,10 +70,16 @@ class EVEPlayerCharacter(EVEAPIModel):
@property
def account(self):
if self.eveaccount_set.count():
return self.eveaccount_set.all()[0]
if self.eveaccount_set.filter(api_status=API_STATUS_OK).count():
return self.eveaccount_set.filter(api_status=API_STATUS_OK)[0]
return None
@property
def active_key(self):
if self.eveaccount_set.count():
return self.eveaccount_set.filter(api_status=API_STATUS_OK).count() > 0
return False
@models.permalink
def get_absolute_url(self):
return ('eveapi-character', [self.pk])