A

Admin • 828.03K Points
Coach

Q. What is the use of `__str__()` method in Django models?

  • (A) To return a JSON representation
  • (B) To return a string representation
  • (C) To return object memory address
  • (D) To return HTML output
  • Correct Answer - Option(B)
  • Views: 8
  • Filed under category Django
  • Hashtags:

Explanation by: Admin
`__str__()` defines how the object is represented as a string.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.