I\'m reading and trying to understand django documentation so I have a logical question.
There is my models.py
file
from django.db import mo
The __str__
function is used add a string representation of a model's object, so that is
to tell Python what to do when we convert a model instance into a string.
And if you dont mention it then it will take it by default the USERNAME_FIELD
for that purpose.
So in above example it will convert Blog
and Author
model's object to their associated name
field and the objects of Post
model to their associated headline
field