A

Admin • 802.91K Points
Coach

Q. What does `__str__` method do in a Django model?

  • (A) Renders a model’s database table
  • (B) Returns model field count
  • (C) Returns a human-readable string for the model
  • (D) Validates the model
  • Correct Answer - Option(C)
  • Views: 4
  • Filed under category Django
  • Hashtags:

Explanation by: Admin
`__str__` returns a string representation of the model, used in admin and shell.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.