From 0576b70f921e7bdf9d950ecb8c4202200a61d5f9 Mon Sep 17 00:00:00 2001 From: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com> Date: Tue, 17 Sep 2019 16:24:10 +0200 Subject: Make API return infraction list with newest first The most recent infraction a user has is usually the most relevant to us. This PR aims to make our life easier by sorting the infractions by their `inserted_at` date, with the most recent insertion date first. Note: The `id` is not entirely in chronological order, because we did not import historical infractions in chronological order. That's why the `inserted_at` field is specified instead of the `id` field. --- .../migrations/0042_infraction_add_default_ordering.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pydis_site/apps/api/migrations/0042_infraction_add_default_ordering.py (limited to 'pydis_site/apps/api/migrations') diff --git a/pydis_site/apps/api/migrations/0042_infraction_add_default_ordering.py b/pydis_site/apps/api/migrations/0042_infraction_add_default_ordering.py new file mode 100644 index 00000000..1a0dbb34 --- /dev/null +++ b/pydis_site/apps/api/migrations/0042_infraction_add_default_ordering.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.3 on 2019-09-17 14:07 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0041_add_default_ordering_deleted_messages'), + ] + + operations = [ + migrations.AlterModelOptions( + name='infraction', + options={'ordering': ['-inserted_at']}, + ), + ] -- cgit v1.2.3