Changes between Version 12 and Version 13 of NewbieMistakes


Ignore:
Timestamp:
Dec 13, 2005, 10:16:07 PM (19 years ago)
Author:
GomoX <gomo@…>
Comment:

Changed repr references to str

Legend:

Unmodified
Added
Removed
Modified
  • NewbieMistakes

    v12 v13  
    5050==== Probable cause ====
    5151
    52 You may have forgotten to create a {{{__repr__()}}} function for your model. Django calls {{{__repr__()}}} to find out how to display objects in the admin interface.
     52You may have forgotten to create a {{{__str__()}}} function for your model. 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.
    5353
    5454==== Solution ====
    5555
    56 Add a {{{__repr__()}}} function to all your models. Make it a habit so it becomes automatic.
     56Add a correct {{{__str__()}}} function (without brackets in the output) to all your models. Make it a habit so it becomes automatic.
    5757
    5858== Integer & NULLS ==
Back to Top