Use of unicode in Django

django, python

Solution

It's not. If you define a `__unicode__()` method, Django will call it when it needs to render an object in a context where a string representation is needed (e.g. in the model's admin pages).

The documentation says:

The `__unicode__()` method is called whenever you call `unicode()` on an object. Since Django's database backends will return Unicode strings in your model's attributes, you would normally want to write a `__unicode__()` method for your model.

Problem

Why is a unicode function required in models.py? i.e, ``` def __unicode__(self) return sumid; ```

Original source