Nobody has started this yet — be first.
Business impact
This is a personal library tracker -- the whole point of the list view is "what did I just add." Right now the default GET /api/books/ order buries every new addition at the very last page instead of the first, which for anyone with more than a page of books means the app looks "broken" or "stuck" every time they add something, since the thing they just did is invisible until they page all the way through. It's the kind of regression that doesn't throw an error anywhere, so it won't show up in a smoke test -- only in a user actually scrolling and asking "where did my book go?"
Problem
GET /api/books/ (no query params) returns books ordered oldest-added first.
Current behavior
A freshly created book appears on the last page of the list instead of the first.
Expected behavior
GET /api/books/ returns books ordered newest-added first -- the most recently created book appears on page 1.
Steps to reproduce
cd django/library_tracker source ../library_tracker_venv/bin/activate python manage.py shell -c " from books.models import Book Book.objects.create(title='First', author='A') Book.objects.create(title='Second', author='B') print(list(Book.objects.values_list('title', flat=True))) "
Why this matters
Book.Meta.ordering is the single line that controls the default queryset order for every unfiltered list request -- DRF's ModelViewSet doesn't add its own ordering on top, it just executes Book.objects.all() as-is. A leading "-" on a field name means descending; without it, ascending. That's the entire difference between "newest first" and "oldest first," and it's trivial to drop by accident when typing the field name.
Suggested approach
Look at Book.Meta.ordering in books/models.py and compare it against what "most recently added first" requires for a DateTimeField like date_added.
Acceptance criteria
Verification
python manage.py test practicetickets.test_ticket02_ordering_flip -v 2
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
$git checkout -b fix/ordering-flipFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/ordering-flipSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign inhttp://127.0.0.1:8000/api/books/http://127.0.0.1:8000/admin/SECRET_KEYDEBUGALLOWED_HOSTSOr with Docker (migrations run automatically on container startup):
docker compose up --build
docker compose exec web python manage.py createsuperuser # optional, to use /admin/
Work the tickets in practicetickets/ (TICKET_01 through TICKET_07); each names one Django test:
python manage.py test practicetickets.test_ticket01_rating_boundary -v 2 # a single ticket
./practicetickets/run_tickets.sh # all 7, clean pass/fail summary
Tickets are independent and deliberately isolated from each other's bugs -- fix them in any order. python manage.py test books runs the project's own 4-test suite (separate from practicetickets/, which is never added to INSTALLED_APPS) and should report OK both before and after every ticket is fixed.
Level 1
Fix a bug
Read existing behaviour, correct it.