About the Underscore in Django Shell
In the Django Interactive Shell or Python Shell, underscore (_
) refers to the result of the previously executed command.
>>> Post.objects.filter(title="Hello, World!")
[<Post: Hello, World!>, <Post: Hello, World!>]
>>> post1, post2 = _
Tips and Tricks Development Django 5.x Django 4.2 Django 3.2 Python 3
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.