Why does subclassing model field requirement[1] for custom fields is
not applied to django core fields?

[1] http://tinyurl.com/l2lvbx

Any Django field classes has SubfieldBase metaclass declared, so for
an "initial" DateField attribute:

>>> ob = MyModel.objects.create(type=1,initial='2009-01-01')
>>> ob.initial
'2009-01-01'

when I set SubfieldBase metaclass for
django.db.models.fields.DateField as stated in documentation i have:

>>> ob = MyModel.objects.create(type=1,initial='2009-01-01')
>>> ob.initial
datetime.date(2009, 1, 1)

as expected, the to_python method convert the string to a date type.

Thanks!

daniel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to