Hi! On Wed, Aug 26, 2015 at 02:07:38PM -0300, "Gustavo A. D??az" <gustavo.d...@gmail.com> wrote: > Is there anyway to change for date format on DateCol default value? > > I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') but > does not work: > > unhandled formencode.api.Invalid "expected a date/time string of the > '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> > '26-08-2015' instead"
The problem is that the code that's used to parse user input is also used to parse output from the backend, so if you want to change the format yo have to change it at the DB level too. And then you have to change DateTimeConverter to pass date/time strings to the backing in the proper format. See the discussion and some examples at https://github.com/sqlobject/sqlobject/issues/114 Your best bet, I think, is to parse d/t strings yourself and pass date/datetime instances to your column(s). > Thanks! > > -- ^ You have forgotten a space here; signatures are separated by two dashes and a space. (-: > Gustavo A. D??az > GDNet - www.gdnet.com.ar > "Servicios TI para tus necesidades" Oleg. -- Oleg Broytman http://phdru.name/ p...@phdru.name Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss