On Friday, December 29, 2017 at 12:38:24 PM UTC-5, Jordan Ladora wrote:
>
> Brilliant - thank you very much for the thoughtful reply.
>
> I actually set it as a session var bc there are several tables with a
> decimal field that I want to be consistent with each other,
>
Note, the session is unique per user, so it doesn't make sense to store a
global value in the session, as you are unnecessarily storing a separate
copy of it for each user. Instead, just create a constant somewhere in a
model file and use that in your table definitions:
DECPLACES = 7
Or if the only place you need that constant is in defining decimal fields,
just store the entire field type as a constant:
DECFIELD = 'decimal(100, 7)'
Then in your table definitions:
db.define_table(..., Field('myfield', DECFIELD, ...))
Anthony
--
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.