__str__ method in django model code example Example: __str__ in django def __str__(self): return self.name