Fixed history ordering.

This commit is contained in:
A. Svensson 2015-02-22 10:56:16 +01:00
parent df03e1dfe7
commit 7269cfce61
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ class PopulationHistory(models.Model):
players = models.PositiveIntegerField()
class Meta:
ordering = ['timestamp', 'server']
ordering = ['-timestamp', 'server']
def __str__(self):
return '{} {}'.format(self.timestamp, self.server.title)

View File

@ -13,6 +13,6 @@ class ServerDetailView(generic.DetailView):
context = super(ServerDetailView, self).get_context_data(**kwargs)
server = context['server']
# HACK: 24 hours for the last 7 days, might want to change this
context['population'] = PopulationHistory.objects.filter(server=server)[:7*24]
context['population'] = PopulationHistory.objects.filter(server=server)[:7*24*4]
return context