diff --git a/src/pictures/migrations/0005_auto_20210124_1644.py b/src/pictures/migrations/0005_auto_20210124_1644.py new file mode 100644 index 0000000..96bc4e4 --- /dev/null +++ b/src/pictures/migrations/0005_auto_20210124_1644.py @@ -0,0 +1,17 @@ +# Generated by Django 3.1.5 on 2021-01-24 16:44 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pictures", "0004_auto_20210124_1407"), + ] + + operations = [ + migrations.AlterModelOptions( + name="message", + options={"ordering": ["-received_at"]}, + ), + ] diff --git a/src/pictures/models.py b/src/pictures/models.py index ae5f1d6..6dc6676 100644 --- a/src/pictures/models.py +++ b/src/pictures/models.py @@ -28,6 +28,9 @@ class Message(models.Model): content = models.TextField(blank=True) received_at = models.DateTimeField(default=timezone.now) + class Meta: + ordering = ["-received_at"] + def __str__(self): truncator = Truncator(self.content) truncated_content = truncator.words(15)