It's a bug that Django cannot serialize timedelta objects in migrations. It will be fixed in 1.8.1 -- see https://code.djangoproject.com/ticket/24566.
On Friday, April 17, 2015 at 1:06:09 PM UTC-4, Mathijs Jonker wrote:
-- On Friday, April 17, 2015 at 1:06:09 PM UTC-4, Mathijs Jonker wrote:
Hi, I'm trying to figure out how to use a default value with a duration field. When I use time_passed = models.DurationField(default=0) : * Migrations work * Form defaults don't work 'int' object has no attribute 'total_seconds' When I use time_passed = models.DurationField(default=timedelta()) : * Migrations don't work ValueError: Cannot serialize: datetime.timedelta(0) * model default works So what is the right way to use a default value on duration field or is this a bug?
(stackoverflow question: http://stackoverflow.com/questions/29699857/django- )durationfield-default-value
With kind regards, mjonker
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1b73c2b2-6f26-4e2d-9ae6-94fdb619503f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment