Might aswell use existing fields in server_details.html.

This commit is contained in:
A. Svensson 2015-02-23 20:18:08 +01:00
parent a453b4dbf0
commit 02702a4ddb
2 changed files with 3 additions and 8 deletions

View File

@ -13,13 +13,8 @@ class ServerDetailView(generic.DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ServerDetailView, self).get_context_data(**kwargs) context = super(ServerDetailView, self).get_context_data(**kwargs)
server = context['server'] server = context['server']
history = PlayerHistory() history = PlayerHistory()
points = history.get_points(server) points = history.get_points(server)
context['player_history'] = points context['player_history'] = points
timestamp, players = points[0]
context['last_updated'] = timestamp
context['online_players'] = players
return context return context

View File

@ -18,10 +18,10 @@
{% endif %} {% endif %}
<h2>Server History</h2> <h2>Server History</h2>
<p>Last updated <span title="{{last_updated|date:'r'}} GMT"> <p>Last updated <span title="{{server.last_updated|date:'r'}} GMT">
{{last_updated|timesince}} {{server.last_updated|timesince}}
</span>ago.</p> </span>ago.</p>
<p>Online players: {{online_players}}</p> <p>Online players: {{server.current_players}}</p>
<div id="chart"></div> <div id="chart"></div>
<div id="tooltip"></div> <div id="tooltip"></div>