Fixed history ordering.
This commit is contained in:
parent
df03e1dfe7
commit
7269cfce61
@ -18,7 +18,7 @@ class PopulationHistory(models.Model):
|
|||||||
players = models.PositiveIntegerField()
|
players = models.PositiveIntegerField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['timestamp', 'server']
|
ordering = ['-timestamp', 'server']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{} {}'.format(self.timestamp, self.server.title)
|
return '{} {}'.format(self.timestamp, self.server.title)
|
||||||
|
|||||||
@ -13,6 +13,6 @@ class ServerDetailView(generic.DetailView):
|
|||||||
context = super(ServerDetailView, self).get_context_data(**kwargs)
|
context = super(ServerDetailView, self).get_context_data(**kwargs)
|
||||||
server = context['server']
|
server = context['server']
|
||||||
# HACK: 24 hours for the last 7 days, might want to change this
|
# 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
|
return context
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user