Before the model in the model file will do.

On Jun 1, 3:39 pm, NetAdmin <mr.netad...@gmail.com> wrote:
> In which file do I declare the class?
>
> Thanks to everyone for their answers.
>
> On Jun 1, 3:10 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > There is no need to use SQLCustomType in this case. Decimal is
> > supported by web2py type='decimal(n,m)' if the underliying database
> > supports it. The problem is representation of the number.
>
> > Try this:
>
> > class IS_MYDECIMAL(IS_DECIMAL_IN_RANGE):
> >      def formatter(self,value): return '%.2f' % value
>
> > and use the
>
> > db.table.field.requires=IS_MYDECIMAL(0,100)
>
> > On Jun 1, 2:24 pm, Michal Jursa <mic...@jursa.cz> wrote:
>
> > > Hi,
> > > decimal is not directly supported as it is not supported in some db
> > > engines, but you can use SQLCustomType. Example here:
>
> > >http://www.web2py.com/examples/static/epydoc/web2py.gluon.sql.SQLCust...
>
> > > Michal
>
> > > NetAdmin wrote:
> > > > 1. What is the best field choice for currency calculations?
>
> > > > I can't find any documentation on the DECIMAL field-type
> > > > even though I saw  Field('totalsale', 'decimal(10,2)'),
> > > > while browsing google/groups.
>
> > > > 2. Where should I look for the very latest documentation?
>
> > > > I defined a field as DOUBLE, but during an an
> > > > edit using SQLFORM, 40.00 shows as 40.0
>
> > > > 3. How can I display 2 decimal places using SQLFORM?
>
> > > > I'll switch from sqlite to MySQL if needed.
>
> > > > Thanks!

Reply via email to