Added a entry for viewing active API keys

This commit is contained in:
2011-08-31 11:04:35 +01:00
parent 3ed482d329
commit 781ca18db0
2 changed files with 6 additions and 0 deletions

View File

@@ -40,6 +40,11 @@ class EVEPlayerCorporation(EVEAPIModel):
""" Returns the number of characters with stored API keys """ """ Returns the number of characters with stored API keys """
return self.eveplayercharacter_set.filter(eveaccount__isnull=False).count() return self.eveplayercharacter_set.filter(eveaccount__isnull=False).count()
@property
def active_api_keys(self):
""" Returns the number of characters with stored and active API keys """
return self.eveplayercharacter_set.filter(eveaccount__isnull=False, eveaccount__api_status=API_STATUS_OK).count()
@property @property
def director_api_keys(self): def director_api_keys(self):
return self.directors.filter(eveaccount__isnull=False, eveaccount__api_keytype=API_KEYTYPE_FULL, eveaccount__api_status=API_STATUS_OK) return self.directors.filter(eveaccount__isnull=False, eveaccount__api_keytype=API_KEYTYPE_FULL, eveaccount__api_status=API_STATUS_OK)

View File

@@ -15,6 +15,7 @@
{% if view_members %} {% if view_members %}
<li><b>Full Director API Available: {% if corporation.director_api_keys %}<span style="color: green;">Yes</span>{% else %}<span style="color: red;">No</span>{% endif %}</b></li> <li><b>Full Director API Available: {% if corporation.director_api_keys %}<span style="color: green;">Yes</span>{% else %}<span style="color: red;">No</span>{% endif %}</b></li>
<li><b>Members with API Keys:</b> {{ corporation.api_keys }}</li> <li><b>Members with API Keys:</b> {{ corporation.api_keys }}</li>
<li><b>Members with Active API Keys:</b> {{ corporation.active_api_keys }}</li>
<li><b>API Coverage:</b> {{ corporation.api_key_coverage|floatformat:2 }}%</li> <li><b>API Coverage:</b> {{ corporation.api_key_coverage|floatformat:2 }}%</li>
{% endif %} {% endif %}
</ul> </ul>