Ticket #4870: 4870-models-str.patch
File 4870-models-str.patch, 912 bytes (added by , 17 years ago) |
---|
-
tests/modeltests/str/models.py
8 8 with the interactive prompt, but also because objects' representations are used 9 9 throughout Django's automatically-generated admin. 10 10 11 Normally, you should write ``__unicode__``()method, since this will work for11 Normally, you should write a ``__unicode__()`` method, since this will work for 12 12 all field types (and Django will automatically provide an appropriate 13 13 ``__str__()`` method). However, you can write a ``__str__()`` method directly, 14 14 if you prefer. You must be careful to encode the results correctly, though. 15 15 """ 16 16 17 17 from django.db import models 18 from django.utils.encoding import smart_str19 18 20 19 class Article(models.Model): 21 20 headline = models.CharField(maxlength=100)