From 99f718f00210eac93abadd88d57e0c77538f2392 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Sun, 28 Feb 2021 19:12:58 -0500 Subject: [PATCH] order contacts by id asc --- contacts_api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contacts_api/views.py b/contacts_api/views.py index c776b71..a6fbb40 100644 --- a/contacts_api/views.py +++ b/contacts_api/views.py @@ -3,10 +3,10 @@ from .serializers import ContactSerializer from .models import Contact class ContactList(generics.ListCreateAPIView): - queryset = Contact.objects.all() # tell django how to retrieve all objects from the DB + queryset = Contact.objects.all().order_by('id') # tell django how to retrieve all objects from the DB serializer_class = ContactSerializer # tell django what serializer to use class ContactDetail(generics.RetrieveUpdateDestroyAPIView): - queryset = Contact.objects.all() + queryset = Contact.objects.all().order_by('id') serializer_class = ContactSerializer