I have rewrited the code to a hidden input with the default value 
start_date.
Thanks for you're response!

Op dinsdag 6 mei 2014 15:46:04 UTC+2 schreef Kyle Flanagan:
>
> Try the following:
>
> import datetime
> db.bookings.start_date.default = datetime.date(start_year, 
> start_month,start_day
> )
>
>
> Since start_date is the 'date' datatype, it's expecting a python datetime 
> object.
>
> On Tuesday, May 6, 2014 4:22:46 AM UTC-5, Stefan van den Eertwegh wrote:
>>
>> Hi all,
>>
>> I have the following code:
>>
>> db.bookings.start_date.default = "%s-%s-%s" % (start_day, start_month, 
>> start_year)
>>
>> The problem is that when i uncomment this line above, i get the following 
>> error:
>> 'str' object has no attribute 'year'
>>
>> This is de database model:
>> Field('start_date', 'date', default=request.now, 
>> requires=[IS_DATE(format=('%d-%m-%Y')), IS_NOT_EMPTY()]),
>> Field('end_date', 'date', default=request.now, 
>> requires=[IS_DATE(format=('%d-%m-%Y')), IS_NOT_EMPTY()]),
>>
>>
>> I still not get what it could be.
>>
>> I hope to hear from any of you soon!
>>
>> Best regards,
>> Stefan van den Eertwegh
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to