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])

View File

@@ -22,10 +22,10 @@
{% if view_members %}
<table>
<tr><th>Name</th><th>Skillpoints</th><th>Join Date</th><th>Director?</th><th>Roles?</th><th>API Key?</th></tr>
<tr><th>Name</th><th>Skillpoints</th><th>Join Date</th><th>Director?</th><th>Roles?</th><th>API Key?</th><th>Key Active?</th></tr>
{% autopaginate members 20 %}
{% for char in members %}
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td><td>{% if char.total_sp %}{{ char.total_sp|intcomma }} SP{% endif %}</td><td>{{ char.corporation_date }}</td><td>{% if char.director %}Yes{% endif %}</td><td>{% if char.eveaccount_set.count %}{% if char.roles.count %}Yes{% else %}No{% endif %}{% endif %}<td>{% if char.eveaccount_set.count %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td></tr>
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td><td>{% if char.total_sp %}{{ char.total_sp|intcomma }} SP{% endif %}</td><td>{{ char.corporation_date }}</td><td>{% if char.director %}Yes{% endif %}</td><td>{% if char.eveaccount_set.count %}{% if char.roles.count %}Yes{% else %}No{% endif %}{% endif %}<td>{% if char.eveaccount_set.count %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td><td>{% if char.active_key %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td></tr>
{% endfor %}
</table>
{% paginate %}