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
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
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
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
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
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'),
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
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
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'),
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
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
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
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
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
>>
&
"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
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://
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
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
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
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
>
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
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
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
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
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')
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
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
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
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
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)
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
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
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
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
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
35 matches
Mail list logo