Complete the code to safely filter users by username using Django ORM.
users = User.objects.filter(username=[1])The Django ORM safely handles string values in filter to prevent SQL injection.
Complete the code to safely get a user by id using Django ORM.
user = User.objects.get(id=[1])Passing an integer literal directly is safe and prevents injection.
Complete the code to safely filter users by email using Django ORM.
users = User.objects.filter(email=[1])Using a string literal in the ORM filter is safe against SQL injection because the ORM automatically parameterizes queries.
Fill both blanks to safely filter users with age greater than 18 and username equals 'alice'.
users = User.objects.filter(age__[1]=18, username=[2])
Use 'gt' for greater than and a quoted string for username to prevent injection.
Fill all three blanks to create a safe query that excludes users with is_active False, filters by last_name 'Smith', and orders by 'date_joined'.
users = User.objects.exclude(is_active=[1]).filter(last_name=[2]).order_by([3])
Use boolean False without quotes, quote string values, and pass field names as strings to order_by.