Changes between Version 41 and Version 42 of IrcFAQ


Ignore:
Timestamp:
Jul 25, 2007, 12:01:03 AM (17 years ago)
Author:
Matt McClanahan <cardinal@…>
Comment:

Add str-vs-unicode question

Legend:

Unmodified
Added
Removed
Modified
  • IrcFAQ

    v41 v42  
    149149
    150150Note that there are no parentheses on `datetime.datetime.now` in this version, so you're passing ''the function itself'' to be the default. When Django receives a function as a default value for a model field, it will call the function each time a new object is saved, and that will correctly generate the current date/time for each object.
     151
     152== I'm trying to use {{{__str__()}}} or {{{__unicode__()}}} on my model, but it's not working == #StrVsUnicode
     153
     154It's likely that you're using {{{__str__()}}} with the development version of Django, or {{{__unicode__()}}} with a release version.  After the release of 0.96, Django's internals became fully Unicode aware.  As a result, model classes that used to use {{{__str__()}}} to provide string versions of themselves need to be updated to use {{{__unicode__()}}} to work with the development version of Django.  However, users of a Django release still need to use {{{__str__()}}}.
     155
     156More information on exactly what changed regarding Unicode in Django is available on the UnicodeBranch page.
Back to Top