time[].
Thanks to psycopg2 the information from database is ready out and
converted into python list.
the list looks like that thought:
[[datetime.time(0, 0), datetime.time(23, 59, 59)], [datetime.time(0,
0), datetime.time(23, 59, 59)], [datetime.time(0, 0),
datetime.time(23, 59, 59)], [datetime.time(0, 0), datetime.time(23,
59, 59)], [datetime.time(0, 0), datetime.time(23, 59, 59)],
[datetime.time(0, 0), datetime.time(23, 59, 59)], [datetime.time(0,
0), datetime.time(23, 59, 59)]]
Now i could create widget, that uses JavaScript to convert it into
time. But it seems to me, that it could be done faster on python side
and since all kinds of time picker widgets deal with time in %H:%M:%S
format it looks wise to both get and give data in same format.
Converting data back to string, which is 'datetime.time(0, 0)' does
not look very nice either.
so, all that brings me to asking - what kind of method of
django.db.models.fields.Field class is called after database read?
from https://docs.djangoproject.com/en/dev/howto/custom-model-fields/
it looks like it should be Field.to_python, but when i add method
like:
def to_python(self, value):
return 'xxx'
to my field, then i still see previously added list of datetimes in my
input not 'xxx'
Can someone help me sort this out please :) - the question is
basically - how can i format the data read from database into desired
format for displaying in formfield?
Alan
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment