Added current_players to Server.

This commit is contained in:
A. Svensson 2015-02-18 21:30:50 +01:00
parent cfa2f0181c
commit 569c5b73ee
3 changed files with 27 additions and 1 deletions

View File

@ -100,6 +100,7 @@ class Command(BaseCommand):
defaults= dict( defaults= dict(
game_url=data['game_url'], game_url=data['game_url'],
site_url=data['site_url'] or '', site_url=data['site_url'] or '',
current_players=data['player_count'],
) )
) )

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('gameservers', '0004_auto_20150218_1915'),
]
operations = [
migrations.AlterModelOptions(
name='server',
options={'ordering': ['-current_players', 'title']},
),
migrations.AddField(
model_name='server',
name='current_players',
field=models.PositiveIntegerField(default=0),
preserve_default=True,
),
]

View File

@ -4,9 +4,10 @@ class Server(models.Model):
title = models.CharField(max_length=255) title = models.CharField(max_length=255)
game_url = models.URLField() game_url = models.URLField()
site_url = models.URLField(blank=True) site_url = models.URLField(blank=True)
current_players = models.PositiveIntegerField(default=0)
class Meta: class Meta:
ordering = ['title'] ordering = ['-current_players', 'title']
def __str__(self): def __str__(self):
return self.title return self.title