πŸ“Š Django
Q. What does the `get_object_or_404()` function do?
  • (A) Deletes a model instance
  • (B) Redirects to 404 page if object is not found
  • (C) Returns None if object is not found
  • (D) Fetches object and suppresses error if not found
πŸ’¬ Discuss
βœ… Correct Answer: (B) Redirects to 404 page if object is not found

Explanation: `get_object_or_404()` returns the object if it exists, otherwise raises a 404 error.

Explanation by: Mr. Dubey
`get_object_or_404()` returns the object if it exists, otherwise raises a 404 error.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
54
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
87%
Success Rate