Fix account lookup, also show accounts on the charlist

This commit is contained in:
2011-05-25 10:33:50 +01:00
parent 12079cb7d8
commit e445d2d82f
2 changed files with 8 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ class EVEPlayerCharacter(EVEAPIModel):
return None return None
@property @property
def account(self) def account(self):
if self.eveaccount_set.count(): if self.eveaccount_set.count():
return self.eveaccount_set.all()[0] return self.eveaccount_set.all()[0]
return None return None

View File

@@ -5,15 +5,21 @@
<h1>Character List</h1> <h1>Character List</h1>
{% if characters %} {% if characters %}
{% regroup characters by account as acc_list %}
<table> <table>
<tr><th>Character Name</th><th>Corporation</th><th>Alliance</th><th>Training</th></tr> <tr><th>Character Name</th><th>Corporation</th><th>Alliance</th><th>Training</th></tr>
{% for char in characters %} {% for acc in acc_list %}
<tr><th colspan=4>Account {{ acc.grouper }}</th></tr>
{% for char in acc.list %}
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td> <tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td>
<td><a href="{% url eveapi-corporation char.corporation.id %}">{{ char.corporation }}</a></td> <td><a href="{% url eveapi-corporation char.corporation.id %}">{{ char.corporation }}</a></td>
<td>{% if char.corporation.alliance %}{{ char.corporation.alliance }}{% endif %}</td> <td>{% if char.corporation.alliance %}{{ char.corporation.alliance }}{% endif %}</td>
<td>{% if char.current_training %}{{ char.current_training.skill.name }} to Level {{ char.current_training.in_training }}{% endif %}</td> <td>{% if char.current_training %}{{ char.current_training.skill.name }} to Level {{ char.current_training.in_training }}{% endif %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endfor %}
</table> </table>
{% endif %} {% endif %}