Changes between Version 12 and Version 13 of NewbieMistakes
- Timestamp:
- Dec 13, 2005, 10:16:07 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NewbieMistakes
v12 v13 50 50 ==== Probable cause ==== 51 51 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.52 You 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. 53 53 54 54 ==== Solution ==== 55 55 56 Add a {{{__repr__()}}} functionto all your models. Make it a habit so it becomes automatic.56 Add a correct {{{__str__()}}} function (without brackets in the output) to all your models. Make it a habit so it becomes automatic. 57 57 58 58 == Integer & NULLS ==