Added portraits in the list, because why not.

This commit is contained in:
Ydmir 2016-01-24 22:32:54 +01:00
parent 986816fdc7
commit bd7bbc9339
3 changed files with 21 additions and 10 deletions

View File

@ -44,7 +44,7 @@ def corp_member_view(request, corpid = settings.CORP_ID):
member_list = EveWhoManager.get_corporation_members(corpid)
characters_with_api = {}
characters_without_api = []
characters_without_api = {}
for char_id, member_data in member_list.items():
try:
@ -58,7 +58,9 @@ def corp_member_view(request, corpid = settings.CORP_ID):
maincorpid = mainchar.corporation_id
except (ValueError, EveCharacter.DoesNotExist):
mainname = "User: " + user.username
maincorp = None
mainchar = char
maincorp = mainchar.corporation_name
maincorpid = mainchar.corporation_id
characters_with_api.setdefault(mainname, Player(main=mainchar,
maincorp=maincorp,
maincorpid=maincorpid,
@ -66,7 +68,7 @@ def corp_member_view(request, corpid = settings.CORP_ID):
).altlist.append(char)
except EveCharacter.DoesNotExist:
characters_without_api.append(member_data["name"])
characters_without_api.update({member_data["name"]: member_data["id"]})
if not settings.IS_CORP:
@ -74,13 +76,13 @@ def corp_member_view(request, corpid = settings.CORP_ID):
context = {"form": form,
"corp": corp,
"characters_with_api": sorted(characters_with_api.items()),
"characters_without_api": sorted(characters_without_api),
"characters_without_api": sorted(characters_without_api.items()),
"search_form": CorputilsSearchForm()}
else:
logger.debug("corp_member_view running in corportation mode")
context = {"corp": corp,
"characters_with_api": sorted(characters_with_api.items()),
"characters_without_api": sorted(characters_without_api),
"characters_without_api": sorted(characters_without_api.items()),
"search_form": CorputilsSearchForm()}

View File

@ -16,4 +16,4 @@ class EveWhoManager():
jsondata = requests.get(url).content
data=json.loads(jsondata.decode())
return {row["character_id"]:{"name":row["name"]} for row in data["characters"]}
return {row["character_id"]:{"name":row["name"], "id":row["character_id"]} for row in data["characters"]}

View File

@ -66,14 +66,19 @@
<div style="overflow:auto;overflow-y:auto;">
<table class="table table-condensed">
<tr>
<th class="""></th>
<th class="text-center">Main character</th>
<th class="text-center">Main corporation</th>
<th class="text-center">Character list</th>
</tr>
{% for mainchar, player in characters_with_api %}
{% for maincharname, player in characters_with_api %}
<tr >
<td>
<img class="ra-avatar img-responsive"
src="https://image.eveonline.com/Character/{{ player.main.character_id }}_64.jpg">
</td>
<td class="text-center">
<p class="">{{ mainchar }}</p>
<p class="">{{ maincharname }}</p>
</td>
<td class="text-center" {% if not corp.corporation_name == player.maincorp%} bgcolor="#FF99AA" {% endif %} >
<p class="">{{ player.maincorp }}</p>
@ -85,10 +90,14 @@
</td>
</tr>
{% endfor %}
{% for charname in characters_without_api %}
{% for character_name, character_id in characters_without_api %}
<tr bgcolor="#DD8822">
<td>
<img class="ra-avatar img-responsive"
src="https://image.eveonline.com/Character/{{ character_id }}_64.jpg">
</td>
<td class="text-center">
<p class="">{{ charname }}</p>
<p class="">{{ character_name }}</p>
</td>
<td class="text-center">
<p class=""></p>