Skip to content

Quiz

1. You want to display a success message after a user successfully submits a form. Which method should you use from the Django message framework?

a. success()
b. info()
c. warning()
d. error()
Answer a. success()
Explanation: The success() method is used to display a success message to the user. It is commonly used to provide positive feedback after a successful action, such as submitting a form.

2. In your Django application, you want to display a message to the user notifying them about an upcoming maintenance window. Which method should you use from the Django message framework to display this message?

a. success()
b. info()
c. warning()
d. error()
Answer b. info()
Explanation: The info() method is suitable for displaying informative messages to the user. It can be used to convey non-critical information, such as notifications about upcoming events or maintenance windows.

3. A user submits a form on your Django application, but some of the fields contain invalid data. Which method from the Django message framework would be appropriate to display an error message to the user?

a. success()
b. info()
c. warning()
d. error()
Answer d. error()
Explanation: The error() method is used to display an error message to the user. It is commonly used to inform the user about validation errors or any other critical issues that prevent successful completion of an action.