[web2py] format Date Time

2016-02-04 Thread Charles tenorio
Hi I'm using DataStore to save my data, and the date format is -MM-DD HH: MM: SS, the problem is that my application runs in a navgador with my Portuguese language, in time to save this erro : "month out of range', becouse in Brazilian DateTime is DD / MM / Y, how do I fix it? -- Reso

Re: [web2py] format double data type

2015-10-29 Thread 黄祥
thank you so much massimiliano for your hints. e.g. import locale locale.setlocale(locale.LC_ALL, 'id_ID.utf8') table.net.represent = lambda value, field: locale.format("%.3f", value, grouping = True) best regards, stifan > > -- Resources: - http://web2py.com - http://web2py.com/book (Document

Re: [web2py] format double data type

2015-10-28 Thread Massimiliano
Try this way: import locale locale.setlocale(locale.LC_ALL, 'it_IT.UTF-8') represent_currency = lambda value, row=None: ‘-' if not value else locale.currency(value, symbol=True, grouping=True, international=False).replace('Eu', '€') change ‘it_IT.UTF-8' to your locale On Wed, Oct 28, 2015 at

[web2py] format double data type

2015-10-28 Thread 黄祥
hi, is it possible to change format double data type? e.g. default format : 1,000.00 expected format (that used in my country) : 1.000,00 i've tried : represent = lambda net, field: format(net, ",.2f").replace(",", ".") got the result : 1.000.00 how can i got the result as expected format someth

Re: [web2py] format question

2015-07-14 Thread Dan Feeney
Try this: db((db.group.name=='manager')&(db.person.group==db.group.id)).select() -Dan -- 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

[web2py] format question

2015-07-12 Thread xmarx
In db, Does referenced field stored as formatted, or as id? for example: db.define_table('group', Field('name'), format = %(name)s) db.define_table('person', Field('name'), Field('sirname'),

[web2py] format field from m:1 table

2015-07-06 Thread Mirek Zvolský
Imagine we have table structure like product >- company >- region Is there a way to have format for company based on region, so I can see region while selecting product? db('company', *fields, format="%(company.name)s, %(region.name)s") I think this is not directly possible and I have some idea

[web2py] Format option in extra_fields

2015-04-07 Thread Carla Raquel
Hi! I'm trying to do something like the code below, but it prompts me the following error : 'SyntaxError: invalid syntax' auth.settings.extra_fields['auth_user']= [Field('Supervisor', 'reference auth_user'), format = '%(db.auth_user.first_name)s %(db.a

[web2py] format='%(name)s' )

2015-03-22 Thread KPlusPlus
Hello I'm having an issue while compiling a module file here is the code # -*- coding: utf-8 -*- #Products Table db.define_table=('product', Field('name',notnull=True,unique=True), Field('prices','double'), Filed('description','text'),

[web2py] Format clause for multiple table relationships

2015-01-01 Thread Gary Cowell
I want the 'format' for the dropdown when I create a 'run' entry to be 'manufacturer.name model.model shoe.purchased' e.g. 'Mizuno Wave Rider 10-11-2014' for instance where 'Mizuno' is the manufacturer name, 'Wave Rider' is the model.model, and the date is shoe.purchased I managed to get the

[web2py] format does not work for SQLFORM

2014-12-26 Thread t_glezakos via web2py-users
My application manages debits of hardware to personnel Here is my model: ## table that holds firms providing hardware db.define_table('providers', Field('eponymia', 'string', label='Name'), Field('address', 'string', label='Address'), Field('perioxi

[web2py] Format specification for chained one to many

2014-10-29 Thread Ron McOuat
I have a model where roads are the base table. In a one to many relation I have intersection addresses and each address has many pieces of equipment. Model looks like this # Road table, some winding roads are both street and avenue db.define_table('road', Field('name', 'string', length=32, u

[web2py] Format dropdown list generated from a database table with OPTION helper

2014-09-17 Thread Fei Zhao
I would like to generate a dropdown list dynamically according to the records of a table, which refers to other tables. But it seems that lambda doesn't work with OPTION helper. For instance, I defined four tables, t_country, t_state, t_city, and t_birthplace. Table t_birthplace refers to those

[web2py] Re: SQL Muli Select to Web2py format

2014-02-22 Thread Fcosqui
do a count distinct ? > That is supported by DAL (check the book) > > On Thursday, February 20, 2014 3:31:18 PM UTC+1, Fcosqui wrote: >> >> Hi ! >> >> I want to translate this query to Web2py format, but i have found nothing >> in Documentation >> &

[web2py] Re: SQL Muli Select to Web2py format

2014-02-20 Thread Niphlod
"ip" are in the table why bother with a subselect when you can do a count distinct ? That is supported by DAL (check the book) On Thursday, February 20, 2014 3:31:18 PM UTC+1, Fcosqui wrote: > > Hi ! > > I want to translate this query to Web2py format, but i have found no

[web2py] SQL Muli Select to Web2py format

2014-02-20 Thread Fcosqui
Hi ! I want to translate this query to Web2py format, but i have found nothing in Documentation SELECT COUNT(ip) from (SELECT ip FROM info GROUP BY ip) as b; i don't want to use "executesql" someone can help me? thnx -- Resources: - http://web2py.com - http://

[web2py] Format date after selecting field from database

2013-12-09 Thread Simon Carr
I have this line comment_RS = self.db(self.db.aol_comments.aol_id == item.text(0)).select( orderby=~self.db.aol_comments.comment_date) I want to format the date field like dd/mm/ How would I do this in Python? Thanks Simon -- Re

[web2py] format and represent on table

2013-03-26 Thread 黄祥
hi, i've already define format in table but it seems return the id instead of the format i've define, when i define represent on the field of the other field it can work. is it normal? *e.g. work* db.define_table('booking', Field('scheduled_start', 'datetime'), Field('due_date', 'dateti

[web2py] Format of Start Time in scheduler_task

2012-09-15 Thread Martin Weissenboeck
A minor problem: Looking at a row of db.scheduler_task using admin shows: Start Time: Next Run Time: Stop Time: "Next Run Time" and "Stop Time" use the format "%d.%m.%Y %H:%M:%S" (the format I have choosen). "Start Time" shows date and time in the default format "%Y-%m-%d %H:%M:%S" I think that

[web2py] format attribute in Record Representation

2012-08-01 Thread lyn2py
I refer to http://web2py.com/books/default/chapter/29/6 under Record representation > The format attribute will be used for two purposes: > >- To represent referenced records in select/option drop-downs. > > >- To set the db.othertable.person.represent attribute for all fields >

[web2py] Format representation in foreign table.

2012-05-20 Thread rahulserver
I have two tables: db.define_table('Account_Master',Field('Account',requires=IS_NOT_EMPTY()),Field('Sewadari1'),Field('Mb1'),Field('Sewadari2'),Field('Mb2'),Field('City'),Field('District'),Field('State'),Field('Email'),Field('Remark'),format='%(Account)s %(State)s ') db.define_table('Transaction

[web2py] format parameter not working?

2011-12-23 Thread Thomas Dall'Agnese
Hi, I set the format of a table to a given field, and reference it in another table. Unfortunately, the format seems to be ignored and instead of a combobox there is a textfield where I can input manually the id of the referenced table. I am using the trunk version. Do I need to set up anything

Re: [web2py] format=

2011-11-15 Thread Jim Steil
Richard Thanks for the clarification. My solution was only form-level, without regard for foreign key relations. -Jim On 11/15/2011 8:52 AM, Richard Vézina wrote: By default web2py will only work with id (I think) except if you go with legacy feature (see book about that). So by default

Re: [web2py] format=

2011-11-15 Thread Richard Vézina
By default web2py will only work with id (I think) except if you go with legacy feature (see book about that). So by default with what you propose both will pass the id to your FK field of your foreigh table. But in one case user will see name of person only and in the other case name and id of the

Re: [web2py] format=

2011-11-15 Thread Jim Steil
Chapter 7 of the book covers this pretty well. http://web2py.com/book/default/chapter/07#Database-Validators I would use the .requires attribute of the field. Ex To display the name and return the name... db.tableName.name.requires = IS_IN_DB(db, 'person.name', '%(name)s', zero='choose one')

[web2py] format=

2011-11-15 Thread annet
To represent referenced records in select/option drop-downs the web2py book gives two options: db.define_table('person', Field('name'), format='%(name)s') db.define_table('person', Field('name'), format='%(name)s %(id)s') In an application I need a drop down that inserts a name as a value and I

[web2py] format strings and multiple levels of indirection

2011-02-14 Thread rocket
Hi, I have two tables defined like this: db.define_table('t_client', Field('f_name', type='string', notnull=True, label=T('Name')), format='%(f_name)s') db.define_table('t_project', Field('f_name', type='string', notnull=True, label=T('Name')), Field('f_tbte_project_number', type

[web2py] format vs represent vs IS_IN_DB(..., label='', ...)

2010-12-09 Thread John-Kim Murphy
In the Web2Py book section describing the format attribute of a table there is a brief mention of represent. It seems they serve related but different purposes. Also the label parameter of IS_IN_DB() is also very similar. They all have the same format, anyways (and accept lambda functions) What

[web2py] format problem, please help

2010-11-25 Thread ramazotto
Hi, I have a problem with displaying a table id as a dropdown list in a form. Database looks like that: db.define_table('target', Field('name', required=True), Field('address', required=True), Field('comment', default=''), format='%(name)s') db.define_table('pac', Field('name', r

[web2py] format=

2010-10-04 Thread andrej burja
how or where should i define format representation for records if i put it in db.define_table: db.define_table('oseba', Field('ime'), Field('priimek'), Field('naslov'), Field('email',label='Elektronski naslov'), format='%(ime)s %(priimek)s') there is a id reference in SQLTABLE (not ime priimek)

[web2py] Format= ?

2010-09-25 Thread Johann Spies
Using the following in my tables: signature = db.Table(db, 'signature', Field('created_on', 'datetime', default=request.now,readable=True,writable=False), Field('created_by', db.auth_user, default=auth.user_id, readable=True,wri

[web2py] format of fk field

2010-06-29 Thread Jean-Guy
Hello, I know there is a way to show an other field value of the same row for a fk field. Is that correct? How to do it? This work in case of m2m table : If you check in appadmin in membership table the group_id are replaced by the role of the auth_group table... I there a way to do the sam

Re: [web2py] format zero IS_IN_DB

2010-01-28 Thread Thadeus Burgess
http://groups.google.com/group/web2py/browse_thread/thread/e0ed90f8e72960f6 Please follow the above thread. Massimo said he was thinking about how to procede with the matter. -Thadeus On Thu, Jan 28, 2010 at 11:05 AM, DenesL wrote: > > Back in Jan.2/10 the default for zero was changed to

[web2py] format zero IS_IN_DB

2010-01-28 Thread DenesL
Back in Jan.2/10 the default for zero was changed to '' http://groups.google.com/group/web2py/msg/684a2374e7379861 Consider: db.define_table('person',Field('name',unique=True), format='%(name)s') db.define_table('dog',Field('name',unique=True),Field ('owner',db.person), format='%(name)s') will g

[web2py] format = lambda ... give error

2010-01-17 Thread KMax
Please find test code below If i remove format = lambda x: from defining db.a, no error appears Error traceback Traceback (most recent call last): File "gluon/restricted.py", line 171, in restricted File "C:/!Work/web2py/applications/test/models/db.py", line 9 format = '%(a