On Sunday, January 28, 2018 at 3:28:22 AM UTC-5, Andrea Fae' wrote:
>
> Thank you Anthony. Where is it written that represent passes 2 positional
> arguments in this way?
>
I guess it was meant to seem obvious from the examples. This is a common
pattern with callback functions in Python. Feel
Thank you Anthony. Where is it written that represent passes 2 positional
arguments in this way?
2018-01-27 14:26 GMT+01:00 Anthony :
> On Friday, January 26, 2018 at 2:01:26 PM UTC-5, Andrea Fae' wrote:
>>
>> for me it's worst than before!
>> what is other_table? Why you
On Friday, January 26, 2018 at 2:01:26 PM UTC-5, Andrea Fae' wrote:
>
> for me it's worst than before!
> what is other_table? Why you don't use row? I don't understand...I'm sorry
>
Python makes a distinction between positional and keyword arguments to
functions. When web2py calls the represent
for me it's worst than before!
what is other_table? Why you don't use row? I don't understand...I'm sorry
Il giorno venerdì 26 gennaio 2018 10:50:49 UTC+1, Massimiliano ha scritto:
>
> The first argument of the represent function is the field value.
> So in the the second example the `id` arg is
The first argument of the represent function is the field value.
So in the the second example the `id` arg is the other_id value.
Maybe the example could be more clear in this way:
db.mytable.other_id.represent = lambda id, row: db.other_table[id].other_field
On Fri, Jan 26, 2018 at 10:24 AM,
"Represent" from web2py book
But what exactly are the relationship between "other_id" and "is" in the
second example?
And in the third from what is get the variable "value"?
Thank you
.represent can be None or can point to a function that takes a field value
and returns an alternate
*modules/test_field_constructor.py*
represent_reference_0 = lambda value, field: \
A('%s, %s, %s' % (field.address.street, field.address.city,
field.address.country),
_href="http://maps.google.com/maps?f=q=en=%s,+%s,+%s;
% (field.address.street, field.address.city,
is it possible to have represent for foreign key table?
e.g.
db.define_table('address',
Field('address', 'text'),
Field('zip_code'),
Field('city'),
Field('country'),
format = lambda r: '%s, %s, %s, %s' % (r.address, r.zip_code, r.city,
r.country) )
def on_define_id_card(table):
"""
does the problem persist if you use vars instead of args?
--
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
I want to represent a field with a link to a function in an
SQLFORM.smartgrid with reference to the row:
db.place.mode.represent=lambda mode,row: A(mode,_href=URL(
'place_mode_change',args=[row.id],user_signature=True))
In the above expression the link A is constructed from the mode which is
Hello,
The represent works fine for grid view but
I need to apply represent function for the add, edit forms.
db.product.price.represent = lambda x, row: current.currency.format_price(x)
Inside html template I use {{=form}}
as well as {{=form.custom.widget.price}}
Thank you for the help.
--
In the following table, the session_name is represented as a link. I want
to pass session.id in args (rather than args=1 as you see below). How do I
do that? I've tried various ways to say args=db.sessions.id, and it's as
if the sessions.id value is not being picked up.
I have a form that was created by CRUD, I also update this form by CRUD.
In another thread I was told by Anthony about a field widget controlling
what is seen (he stated this is for: read-only forms, SQLTABLE,
SQLFORM.grid, and when calling rows.render()) however per the book it says
that to
hi,
is it possible to make represent work in form field?
e.g.
db.product.price.represent = lambda price, field: format(price,
,d).replace(,, .)
this work only in view, not in the form field, my expectation is when user
input the price in input field they will have . for thousand separated,
hi,
i use smartgrid with links and have a represent for that table. when the
links is clicked it returned an error, so that i must make a condition for
that.
e.g.
*models/db.py*
# on_define_shop
def on_define_shop(table):
# represent
* if 'shop' in request.function :*
table.website.represent =
I am parsing data out of files and inputting this data into a sqlite db.
One file may have multiple username entries. The data looks something
like this:
[['tom', 324],['dick', 246],['harry', 112]]
The first item in each list is obviously the name. The second line is the
line number (i
thank you so much for your pointers, richard.
best regards,
stifan
--
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
It may be also permission issue?
Richard
On Fri, Feb 7, 2014 at 7:54 PM, 黄祥 steve.van.chris...@gmail.com wrote:
hi,
is it possible to have represent on grid that link to another grid?
e.g.
table.supplier.represent = lambda supplier, field: \
A(supplier.name, _title=T(View Supplier),
Or as you mention the signature that you can pass with URL :
http://web2py.com/books/default/chapter/29/04/the-core#Digitally-signed-urls
Hope it helps
Richard
On Sun, Feb 9, 2014 at 1:46 PM, Richard Vézina
ml.richard.vez...@gmail.comwrote:
It may be also permission issue?
Richard
On
hi,
is it possible to have represent on grid that link to another grid?
e.g.
table.supplier.represent = lambda supplier, field: \
A(supplier.name, _title=T(View Supplier), _target=_blank,
_href=URL('report','report_supplier', args = ['supplier', 'view',
'supplier', field.supplier]) )
i've
Hi,
I want to display item and use the represent() method to display reference
fields.
def home():
all_items = db(db.t_items).select()
owner_rep = db.t_stores.created_by
store_rep = db.t_stores.f_store_name
category_rep = db.t_categories.f_category_name
return dict(all_items =
hi,
is there a way to have represent of list:reference field?
e.g.
models
db.define_table('book',
Field('title'),
Field('cover', 'upload'),
format = '%(title)s')
db.define_table('course',
Field('course_name'),
Field('description', 'text'),
Field('book', 'list:reference book'),
Hello,
I need to display the format value of the referenced table in a
list:reference and not the list of ids.
I have these tables:
db.define_table('personas',
Field('nombres'),
Field('apellidos'),
format='%(nombres)s %(apellidos)s')
db.define_table('publicaciones',
Field('titulo'),
Try db.EventList.startDate.represent = lambda v: v.strftime('%d/%m/%Y') or
None
Note, that will still generate an error if v is None -- you have to first
check for v before applying the strftime method to it.
Anthony
I defined a table EventList:
db.define_table('EventList',
Field('nodeID','reference
Node',default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
Field('summary',length=128,default='',notnull=True),
Field('startDate',type='date'),
Field('endDate',type='date'),
On 19 April 2012 10:36, Annet anneve...@googlemail.com wrote:
db.EventList.startDate.represent = lambda v: v.strftime('%d/%m/%Y')
Is there a way to solve this problem?
Try db.EventList.startDate.represent = lambda v: v.strftime('%d/%m/%Y') or
None
Regards
Johann
--
Because
In db.py I have a table Address which references a table Organization to
display the organization name rather then the nodeID I set a validator:
db.Address.nodeID.represent=lambda nodeID, row:
db(db.Organization.nodeID==nodeID).select().first().name
In 'database db select' Address.nodeID is
The table in db.py
db.define_table('Edge',
Field('hubID',db.Hub,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
Field('byNodeID',db.Node,default='',notnull=True,ondelete='RESTRICT'),
Field('ofNodeID',db.Node,default='',notnull=True,ondelete='CASCADE'),
...
In db.py I have:
db.define_table('Node',
Field('createdOn',type='datetime',writable=False,readable=False),
Field('modifiedOn',type='datetime',writable=
False,readable=False),
migrate=False)
db.define_table('Organization',
Thanks !!
Op 17 januari 2012 00:44 schreef Anthony abasta...@gmail.com het volgende:
On Monday, January 16, 2012 4:47:01 PM UTC-5, Mathias Van Daele wrote:
Thanks for answer Johann.
But how can I catch the value of args in the concerned function ?
args from the URL are always in
On 15 January 2012 22:49, Mathias Van Daele mathias.v.da...@gmail.comwrote:
Hello,
I have a select crud, with a URL in the column id.
If I click 'edit', I should be redirected to a page, where I can
update the concerned contact_part record.
(as in a grid)
What should I put between the
Thanks for answer Johann.
But how can I catch the value of args in the concerned function ?
Thanks
Op 16 januari 2012 13:15 schreef Johann Spies johann.sp...@gmail.com het
volgende:
On 15 January 2012 22:49, Mathias Van Daele mathias.v.da...@gmail.comwrote:
Hello,
I have a select crud,
On Monday, January 16, 2012 4:47:01 PM UTC-5, Mathias Van Daele wrote:
Thanks for answer Johann.
But how can I catch the value of args in the concerned function ?
args from the URL are always in request.args, so in the edit_akb_country()
function, the id would be in request.args(0).
See
Hello,
I have a select crud, with a URL in the column id.
If I click 'edit', I should be redirected to a page, where I can
update the concerned contact_part record.
(as in a grid)
What should I put between the URL brackets ? _href=URL()
How do I pass the selected record ?
My code :
requires = IS_IN_DB(db,'tag.id',db.tag._
format,multiple=True)
displays format of tag in dropdown while editing
how to display format in view. doing
row.tag
displays id
is it different if format of tag is lambda function?
andrej
This table
db.define_table(wbdocuments,
Field(name, label = Document name),
Field(file, upload, label = Download),
format = '%(name)s')
is linked in another table:
db.define_table('wbmaster',
Field('documents',
On 5 April 2011 15:51, Richard Vézina ml.richard.vez...@gmail.com wrote:
About zero option, search in page for zero :
http://www.web2py.com/book/default/chapter/07
http://www.web2py.com/book/default/chapter/07There is some explanation
near IS_IN_SET...
Thanks. I found it.
Johann
--
On 4 April 2011 16:11, Richard Vézina ml.richard.vez...@gmail.com wrote:
Are course_week1 and course_week2 not null??
No.
If not you need ...requires=IS_NULL_OR(IS_IN_DB(your requires) and in
...represent= you should use zero option (see book about that) or something
like that :
On 5 April 2011 09:16, Johann Spies johann.sp...@gmail.com wrote:
Thanks! That solved the problem. I could not find something in the book
about a 'zero option' though.
Now .represent works on the screen but not in the CSV-output. I have used:
{{
import cStringIO
About zero option, search in page for zero :
http://www.web2py.com/book/default/chapter/07
http://www.web2py.com/book/default/chapter/07There is some explanation
near IS_IN_SET...
There maybe more detailed information somewhere else too... I don't use it
in my code since it arrive after I start
I did not use export_to_csv for now... I just test it sometimes ago... But I
guest you should define your .represent for stream table before try to apply
them to your csv output...
Hope it helps.
Richard
On Tue, Apr 5, 2011 at 3:27 AM, Johann Spies johann.sp...@gmail.com wrote:
On 5 April
I want to get a proper representation of a field in the result of a left
join but am struggling to do so.
Here is a simplified version of the problem.
db.define_table('courses',
Field('week','integer', requires=IS_IN_SET([1,2]),
widget =
Are course_week1 and course_week2 not null??
If not you need ...requires=IS_NULL_OR(IS_IN_DB(your requires) and in
...represent= you should use zero option (see book about that) or something
like that :
db.t_registration_form.course_week1.represent=\
lambda value: (value!=None and %(code)s
Working with web2py again after some time, I got acknowledged of the
represent and compute attributes in DAL. They both seem very
attractive to me but I would like to see some more examples of their
usage because of the spare description in the book. Anyone could help?
btw, I found out the great
I have the same problem... I think there is a bug.
Try to do this :
'db.adres'
In your model inwoner.
For me it solve the problem in old app (create in june or july that I
transfert from one web2py version to an other since that time)... But not
working if I am using a new freshly created app.
I get the following output :
inwoner.idinwoner.vaninwoner.adres1Spies1
the following code:
db.define_table('adres',
Field('straat'))
db.define_table('inwoner',
Field('van'),
Field('adres', db.adres,
requires =
Hello Bruno,
I´m implementing powertables and can´t get it to show a reference field
correctly.
In my models:
Field('f_customer', type='reference t_customer',
label=T('Customer'), represent = lambda id:
db.t_customer(id).f_internal_name),
But when opening the Details it shows the
It is a problem with SQLTABLE, detail tables is pure SQLTABLE, SOme people
identified a bug in SQLTABLE regarding references representation.
It is showing the ID or sometines None for references.
there is a workaround for that, using the represent direct on your model,
try that.
The following works:
db.teacher.id.represent = lambda id:
A('edit',_href=URL(r=request,c='default',f='edit_teacher',args=str(id)))
and the following not:
db.school.id.represent = lambda id: db.school(id).name
db.school.id is shown in jqgrid.
How do I get the School name to show up in jqgrid?
I know this issue has come up before but I'm having a hard time
finding the answer. My table has fields x and y. I want to do a
represent like this:
db.mytable.x.represent=lambda val: XML('div class=highlighted%s/
div'%val) if (x and not y) else val
Well, obviously, the above won't work.
If I do this:
db.friendship.to_user.represent = lambda id: db.auth_user[id].nickname
friends = crud.select(db.friendship, db.friendship.from_user ==
auth.user.id,
fields=['id', 'to_user'],
headers={'id':T('ID'),
'to_user':T('Friend')})
51 matches
Mail list logo