Thank you for you're information. I have manually changed the fields to keep the data.
Op vrijdag 15 augustus 2014 11:00:57 UTC+2 schreef Marin Pranjić: > > Do you need to keep existing data? > > If you don't, the easiest solution would be to drop affected tables, > remove their *.table files (stored in databases directory), and let web2py > recreate it. > > If you need to keep the data, but you don't care about those float/double > fields, you can manually change those fields. > > [I wonder why web2py didn't automigrate...] > > > On Fri, Aug 15, 2014 at 10:42 AM, Stefan van den Eertwegh < > stefan....@gmail.com <javascript:>> wrote: > >> Yes, that fixed the issue. but only for a new field, it adds the new >> field in mysql as type double. >> If i change a current field in the model to double than it stays as int >> in mysql. >> >> Shall i change the fields manually in mysql? >> >> Op vrijdag 15 augustus 2014 10:35:49 UTC+2 schreef Marin Pranjić: >>> >>> Can you change "float" to "double" and try if it fixed the issue? >>> >>> Marin >>> >>> >>> On Fri, Aug 15, 2014 at 10:31 AM, Stefan van den Eertwegh < >>> stefan....@gmail.com> wrote: >>> >>>> db.define_table( >>>> 'invoice_rule', >>>> Field('invoice', db.invoice, label=T('Invoice no.')), >>>> Field('amount', 'float', label=T('Amount')), >>>> Field('product', 'float', label=T('Product'), >>>> requires=IS_EMPTY_OR(IS_IN_DB(db, db.product.id, db.product._format))), >>>> Field('description', 'string', label=T('Description')), >>>> Field('date', 'date', label=T('Date')), >>>> Field('vat_percentage', 'string', >>>> requires=IS_IN_SET(settings.vat_percentage), >>>> label=T('VAT')), >>>> Field('quantity', 'float', label=T('Quantity')) >>>> ) >>>> >>>> >>>> Met vriendelijke groet, >>>> Stefan van den Eertwegh >>>> >>>> >>>> 2014-08-15 10:26 GMT+02:00 Marin Pranjić <marin....@gmail.com>: >>>> >>>>> Can you show us your table definition? >>>>> Web2py doesn't have float. There are double and decimal field types. >>>>> You don't need to use postgres. >>>>> >>>>> Marin >>>>> >>>>> >>>>> On Fri, Aug 15, 2014 at 10:22 AM, Stefan van den Eertwegh < >>>>> stefan....@gmail.com> wrote: >>>>> >>>>>> I use in the model the type float and MySQL as backend database and >>>>>> MySQL uses INT() as datatype for that field.... >>>>>> >>>>>> So i must use decimal(10,2) as field type in the model and as backand >>>>>> db postgres? >>>>>> >>>>>> Op donderdag 14 augustus 2014 21:39:56 UTC+2 schreef Cliff Kachinske: >>>>>>> >>>>>>> What database? >>>>>>> >>>>>>> Web2py has a decimal datatype which, in my use cases, mimics the >>>>>>> Python decimal datatype. I use Postgresql and the adapter turns Python >>>>>>> decimal into Postgres numeric. Both of these types act like real world >>>>>>> decimal numbers. In other words, .2 + .1 comes out to .3. Of course a >>>>>>> different db backend may work differently. >>>>>>> >>>>>>> Just google python decimal. >>>>>>> >>>>>>> On Friday, July 11, 2014 5:50:30 AM UTC-4, Stefan van den Eertwegh >>>>>>> wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> I have a float type in the define tables and when he inserts 3.50 >>>>>>>> into the database he makes 4.0 off it. >>>>>>>> How comes that it rounds off the float? And not uses the usage of 2 >>>>>>>> decimals? >>>>>>>> >>>>>>>> Thank you! >>>>>>>> >>>>>>> -- >>>>>> 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 web2py+un...@googlegroups.com. >>>>>> >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>>> 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 a topic in the >>>>> Google Groups "web2py-users" group. >>>>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>>>> topic/web2py/IUs0Zjgmseo/unsubscribe. >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> web2py+un...@googlegroups.com. >>>>> >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>>> 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 web2py+un...@googlegroups.com. >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> 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 web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.