#8633: Field default value force to unicode when create custom field.
---------------------------------------------------+------------------------
Reporter: flytwokites | Owner: nobody
Status: closed | Milestone:
Component: Database layer (models, ORM) | Version: SVN
Resolution: invalid | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Comment (by carljm):
Just to document this further for anybody else who stumbles across this:
the "mistake" here is in setting a Field's default value to any mutable
object (a Hand instance, a list, a set, whatever). This is almost
certainly not what you want to do, as a reference to the same _instance_
of that object would be used as the default value for that field in all
new model instances. So Django instead forces that default value to
unicode, which is immutable.
The correct approach is to instead use as the default a callable that
returns a Hand instance (or list, or set, or whatever).
--
Ticket URL: <http://code.djangoproject.com/ticket/8633#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---