A

Admin • 828.03K Points
Coach

Q. What is the purpose of __str__ method in Django models?

  • (A) Initialize model
  • (B) Return the model id
  • (C) Return a string representation
  • (D) Create a new object
  • Correct Answer - Option(C)
  • Views: 17
  • Filed under category Django
  • Hashtags:

Explanation by: Admin
__str__ is used to define the string representation of the model instance.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.