:-)

On Aug 26, 6:31 pm, RipRyness <ripryn...@gmail.com> wrote:
> This seems to have solved my problem.
>
> On Aug 26, 5:15 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > just to clarify. does this solve the original or you still have a
> > problem? If you still have a problem, could you open a ticket on
> > google code?
>
> > Massimo
>
> > On Aug 26, 5:12 pm, RipRyness <ripryn...@gmail.com> wrote:
>
> > > What I did was create an en-us.py file in the languages folder.
> > > {
> > > 'use format yyyy-mm-dd': 'use format m/d/yyyy',
> > > '%Y-%m-%d': '%m/%d/%Y',
> > > '%Y-%m-%d %H:%M:%S': '%m/%d/%Y %H:%M:%S'
>
> > > }
>
> > > in my model I had this
> > > ...
> > > Field('dob', 'date', requires=[IS_DATE(format=T('%Y-%m-%d'),
> > > error_message=T('use format yyyy-mm-dd')),
> > > IS_NOT_EMPTY(error_message=T('value required'))],
> > > widget=datepicker.widget),
> > > ...
>
> > > also my custom widget needed to set the "old_value" attribute so when
> > > a form failed validation the widget could control the formatting
>
> > > v = v if type(v)==type('') else f.formatter(v)
> > > inp = SQLFORM.widgets.string.widget(f, v, _class="jqdate", _size="10",
> > > old_value=v)
>
> > > -Rip
>
> > > On Aug 22, 11:52 pm, annet <annet.verm...@gmail.com> wrote:
>
> > > > Here's an excerpt of my log that might be helpful:
>
> > > > Formatting date
>
> > > > Model file:
>
> > > > T.force('en-de')  ## en-de is a language file you'll create below
>
> > > > In the table definition:
>
> > > > SQLField('fieldname', type='date')
>
> > > > ... a validator on this field which reads like:
>
> > > > db.tablename.fieldname.requires=IS_NULL_OR(IS_DATE(str(T('%Y-%m-
> > > > %d'))))
>
> > > > Languages file:
>
> > > > ... create a language file e.g. en-de.py and edit the dates:
>
> > > > Original                                Translation
> > > > %Y-%m-%d                                %d-%m-%Y
> > > > %Y-%m-%d %H:%M:%S               %d-%m-%Y %H:%M:%S
>
> > > > Click update.
>
> > > > Views file:
>
> > > > ... to use the date in a view:
>
> > > > {{=db.tablename.fieldname.formatter(tablename.fieldname)}}
>
> > > > If you use form_factory to create a custom form, the code in the
> > > > controller should read:
>
> > > > SQLField('fieldname',type='date',requires=IS_DATE(str(T('%Y-%m-
> > > > %d'))))
>
> > > > Kind regards,
>
> > > > Annet.

Reply via email to