To string

“To string” is a way to represent model when it’s printed or converted to a string. It’s often used to display models.


The easiest way to convert to string is to add a “=” modifier to the field:


The resulting code is:

class Cat(model.Model):
    name = models.CharField(null=True, blank=True, max_length=100, default='')

    def __str__(self):
        return str( or "Cat {}".format(


Another option is to use an expression. The syntax is as follows:

="some expression here"

An expression is just a string template with a “me” variable (python .format() function)

="{me.project} -> {}: #{}"

project: one(#project -> notes)

date: date
text: longtext