#12401: DateField/DateTimeField is not instantiated with Python
datetime.date/datetime object until after retrieving from the database
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
heidar_rafn | Status: closed
Type: Bug | Component: Core (Other)
Milestone: | Severity: Normal
Version: 1.1 | Keywords: DateField
Resolution: invalid | DateTimeField
Triage Stage: Design | Has patch: 0
decision needed | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 0 |
-------------------------------------+-------------------------------------
Changes (by lukeplant):
* status: new => closed
* resolution: => invalid
* easy: => 0
Comment:
Model attributes are not converted to the correct Python types when you
set the attribute. That's the design decision we made, and one that isn't
going to change without a lot of backwards incompatibilities. It is
consistent with normal Python behaviour - it would be rare for type
checking to occur when attributes are set, and even rarer for type
conversion to occur. In general, I expect to the following to pass, no
matter what 'foo' is:
{{{
>>> x = '2011-06-06'
>>> foo.bar = x
>>> assert foo.bar == x
}}}
The proposed behaviour, though potentially useful or even better for
Django model objects, would certainly violate that expectation, so the
design decision we've made is certainly sensible.
--
Ticket URL: <https://code.djangoproject.com/ticket/12401#comment:10>
Django <https://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.