Q. Which function is used in Django models to define a string representation?

  • (A) __print__
  • (B) __str__
  • (C) __name__
  • (D) __display__
πŸ’¬ Discuss
βœ… Correct Answer: (B) __str__
Explanation: The `__str__` method in models defines the string representation of an object.
Explanation by: Mr. Dubey
The `__str__` method in models defines the string representation of an object.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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