Changes between Version 68 and Version 69 of NewbieMistakes


Ignore:
Timestamp:
Jun 28, 2018, 10:42:11 AM (6 years ago)
Author:
John Franey
Comment:

Replaced references to unicode() with str() and added a note about using unicode() for Python 2.

Legend:

Unmodified
Added
Removed
Modified
  • NewbieMistakes

    v68 v69  
    8282==== Probable cause ====
    8383
    84 You may have forgotten to create a {{{__unicode__()}}} function for your model. Django calls {{{__unicode__()}}} to find out how to display objects in the admin interface. An alternate cause is the string you return from {{{__unicode__()}}} includes brackets (an therefore looks like an html tag), and is cleaned up by the {{{strip_tags}}} template filter, resulting in blank entries.
    85 
    86 ==== Solution ====
    87 
    88 Add a correct {{{__unicode__()}}} function (without brackets in the output) to all your models. Make it a habit so it becomes automatic.
     84You may have forgotten to create a {{{__str__()}}} function for your model ({{{__unicode__()}}} in Python 2). Django calls {{{__str__()}}} to find out how to display objects in the admin interface. An alternate cause is the string you return from {{{__str__()}}} includes brackets (an therefore looks like an html tag), and is cleaned up by the {{{strip_tags}}} template filter, resulting in blank entries.
     85
     86==== Solution ====
     87
     88Add a correct {{{__str__()}}} function (without brackets in the output) to all your models. Make it a habit so it becomes automatic.
    8989
    9090== Integer & NULLS ==
Back to Top