from django.db import models


class GameScore(models.Model):
    name = models.CharField(max_length=24)
    total = models.IntegerField()
    played_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ['-total', 'played_at']

    def __str__(self):
        return f'{self.name}: {self.total} on {self.played_at:%Y-%m-%d}'
