From 00c1ba0b497b21244fa33893c36699806d1cd97a Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Mon, 19 Apr 2021 15:22:34 -0400 Subject: [PATCH] order by -id --- api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index bc7289e..fe06694 100644 --- a/api/views.py +++ b/api/views.py @@ -3,9 +3,9 @@ from .serializers import SessionSerializer from .models import Session class SessionList(generics.ListCreateAPIView): - queryset = Session.objects.all() # tell django how to retrieve all objects from the DB + queryset = Session.objects.all().order_by('-id') # tell django how to retrieve all objects from the DB serializer_class = SessionSerializer # tell django what serializer to use class SessionDetail(generics.RetrieveUpdateDestroyAPIView): - queryset = Session.objects.all() + queryset = Session.objects.all().order_by('-id') serializer_class = SessionSerializer