Complete the code to import the module for background tasks in Django.
from django_q.[1] import async_task
The tasks module from django_q.tasks provides the async_task function to run background tasks asynchronously in Django.
Complete the code to schedule a background task that sends an email.
async_task('[1]', user.id, subject='Welcome')
The function send_mail is commonly used to send emails and can be run as a background task.
Fix the error in the code to correctly run a background task with arguments.
async_task('[1]', user.id, retries=3)
The function name should be passed as a string without parentheses or arguments inside the string.
Fill both blanks to create a background task that retries on failure and logs the result.
async_task('[1]', user.email, retries=[2])
Use send_mail as the task function and set retries to 3 for retrying on failure.
Fill all three blanks to define a background task that updates user stats, logs success, and sets a timeout.
async_task('[1]', user.id, on_success='log_success', timeout=[2], retries=[3])
The task function is update_stats, timeout is 60 seconds, and retries is set to 2.