Ticket #4870: 4870-models-str.patch

File 4870-models-str.patch, 912 bytes (added by Collin Grady <cgrady@…>, 17 years ago)
  • tests/modeltests/str/models.py

     
    88with the interactive prompt, but also because objects' representations are used
    99throughout Django's automatically-generated admin.
    1010
    11 Normally,  you should write ``__unicode__``() method, since this will work for
     11Normally,  you should write a ``__unicode__()`` method, since this will work for
    1212all field types (and Django will automatically provide an appropriate
    1313``__str__()`` method). However, you can write a ``__str__()`` method directly,
    1414if you prefer. You must be careful to encode the results correctly, though.
    1515"""
    1616
    1717from django.db import models
    18 from django.utils.encoding import smart_str
    1918
    2019class Article(models.Model):
    2120    headline = models.CharField(maxlength=100)
Back to Top