Nice one Chris and thanks for reviewing this post. Web2py has indeed come a
long way from 2 years ago and is worthy of a revisit. Cheers!
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Hi All,
I encountered this issue as well. Here is how I resolved it.
*- web2py directory should have welcome.w2p*
Happy Easter!
Noel Villamor
On Sunday, 6 March 2011 09:54:19 UTC+13, Jonathan Lundell wrote:
On Mar 5, 2011, at 12:07 PM, Jonathan Lundell wrote:
On Mar 5, 2011, at 11:35
within the
view you would get two different ids. If you want to specify the id
yourself, just do PluginMModal(..., id='your_id').
Anyway, instantiating in the controller should work. Can you show your
controller and view code?
Anthony
On Tuesday, September 27, 2011 1:00:39 AM UTC-4, Noel
Gotcha! Thanks for the hint Anthony.
Controller:
a=PluginMModal(title='Hello World',content='give this a
try!',close=close,width=30,height=30,id='59d38b19-05aa-4125-a19b-6e17069cd873')
... a.link(...)
View:
{{extend 'layout.html'}}
{{=form}}
{{a=PluginMModal(title='Hello World',content='give
Anthony, I did a similar thing on my first try but with the link created at
the controller, like so:
Controller:
def func():
...
...
modal = PluginMModal(title='Hello World',content='give this a
try!',close=close,width=30,height=30)
form = TABLE(... lots of TR( ...
The Minimal Modal docs states that the plugin is to be instantiated in
the View. I wonder if it is possible to do it in the Controller as I
am constructing my form (and links) in the Controller. I tried it but
the a.link defined in the controller has an id w/c differs from the
a.link defined in a
It would be handy if I can get hold of a calendar whose individual
dates/days I can decorate based on an event table.
I won't use it as a pop-up or date selector. I just need to display it on a
page and be able to pan the month and year. I see quite a few in .js, do we
have any in .py or
abasta...@gmail.com wrote:
On Tuesday, September 13, 2011 6:11:42 PM UTC-4, Noel Villamor wrote:
I got the * and the ** explanations but António is asking about ***.
Where do you see any mention of ***?
Interesting!
The old:
https://groups.google.com/group/web2py/browse_frm/thread/f4475684a88fef17/45622d797458e974?hl=en#45622d797458e974
The new:
https://groups.google.com/forum/#!topic/web2py/9EdWhKiP7xc
Thanks for clearing up the confusion Anthony.
Noel
On Sep 15, 9:07 am, Anthony
I got the * and the ** explanations but António is asking about ***.
On Sep 14, 5:51 am, Anthony abasta...@gmail.com wrote:
In Python, if you have a list or tuple, you can precede it with an * and
pass it as an argument to a function, and the function will treat it as if
each item in the
Thanks Jan.
On Sep 12, 8:47 pm, jot.be jan.beili...@gmail.com wrote:
Hi,
On Mon, Sep 12, 2011 at 4:57 AM, Noel Villamor noe...@gmail.com wrote:
I have a button which does the following callback:
ajax('{{=URL('callback')}}',['btn1'],':eval');
Then I have the following callback
I have a button which does the following callback:
ajax('{{=URL('callback')}}',['btn1'],':eval');
Then I have the following callback function in my controller:
def callback():
db(db.tbl.id==100).update(data='sampledata')
jquery = ???
return jquery
I can use jquery = alert('Lame
Thank you guys!
Book states:
Code in models, views and controllers is enclosed in web2py code that
looks like this:
try:
execute models, controller function and view
except:
rollback all connections
log the traceback
send a ticket to the visitor
else:
commit all connections
save
Massimo, I feel like a toddler in a playpen right now. Too many toys I
can't decide which one to play!
Nice and fun projects you have there.
On Sep 12, 2:56 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
Not really server side intensive, mostly client side but fun project.
:
val, error = IS_INT_IN_RANGE(0,10)(item)
if error:
return (val, error)
return (mylist, None)
On Thu, Sep 8, 2011 at 11:44 PM, Noel Villamor noe...@gmail.com wrote:
That worked! Thanks Bruno.
I wonder now if I can do
I am dissecting gluon/contrib/spreadsheet.py and I am trying to
understand the ff:
class Sheet:
snip
def __init__(self, rows, cols, url='.', readonly=False,
active=True,
onchange=None):
self.rows = rows
self.cols = cols
self.url = url
Title is well deserved! Congratulations to the team.
I am aware about:
tblAlias = db.mytbl.with_alias('tblAlias')
Is there a similar thing that we can use for fields in select()?
As in:
... .select( db.mytbl.id, db.mytbl.id*2 as fld2)
it with something like
rows[0]['(mytbl.id
* 2)']. Of course, for convenience, you could define fld2='(mytbl.id * 2)' and
then do rows[0][fld2].
What do you want to do with the results?
Anthony
On Thursday, September 8, 2011 3:07:55 AM UTC-4, Noel Villamor wrote:
I am aware about:
tblAlias
I wanted the data entry of a list type field as a plain text box with
comma separated data values. Thus, in my model,I defined the field as:
Field('fld', 'list:integer', widget=SQLFORM.widgets.string.widget)
Using a crud.create form, what extra steps should I do to be able to
save a value such
That worked! Thanks Bruno.
I wonder now if I can do further validation to ensure that all items
are integers and in a specific range. In particular, I wanted to use
the already available validator IS_INT_IN_RANGE. Something like:
IS_LIST(IS_INT_IN_RANGE(0, 10))
It is hacking time.
:)
On
Thanks for the info Anthony.
Denes, you just added a trick to my python arsenal. TY.
Noel
Code:
if form.accepts(request.vars, session):
arr = ['a','b','c']
for i in range(3):
arr[i] = form.vars.x
Desired:
In the for loop, I wanted to have
arr[0] = form.vars.x0
arr[1] = form.vars.x1
arr[2] = form.vars.x2
As you can see, I am not yet a
Do an explicit length declaration in your model definition:
Field('txt','text', length=65536),
Look here:
http://www.web2py.com/book/default/chapter/06?search=Field+constructor
On Sep 7, 3:10 pm, toan75 toa...@gmail.com wrote:
Hi.
I found in 1.98.2, text field type default length is
I am trying to pass a '.' and a '*' as parameters to a controller
function.
controller: test.py
def t():
arr = request.args
return 'alert(%s);' % repr(arr)
url: /myapp/test/t/1/2/3
alert: ['1', '2', '3']
With one dot in between 1 and 3
url: /myapp/test/t/1/./3
alert: ['1', '3']
With
I found this for you:
http://www.plus2net.com/html_tutorial/button-linking.php
Try this:
INPUT type=button value=Finalizar
onclick=location.href='{{=URL(r=request,f='atualizar')}}'/
Noel
On Sep 6, 7:07 am, Fabiano Faver far...@gmail.com wrote:
I'm tryng to put a button thaat calls a action
I see. So that explains the backtracking when two dots are in the URL
(similar behaviour to cd .. at the command line).
:18 pm, Bruno Rocha rochacbr...@gmail.com wrote:
I dont know if this is the best approach, but I juste tested here and works.
On Wed, Aug 31, 2011 at 2:17 AM, Noel Villamor noe...@gmail.com wrote:
I wanted to pass an array from jQuery to a controller.
script
var xyz= ['Sun','Mon','Tue','Wed
Say I have a parent table tblA and child table tblX:
db.define_table('tblA',
Field(fldA'))
db.define_table('tblB',
Field('fkA', db.tblA),
Field('name', 'integer'),
Field('data'))
How do I left join the two queries on tblB below:
1st: db(db.tblB.fkA ==
TABLE db.tblB
fkA, name, data
1,100,'aaa'
1,101,'bbb'
1,102,'ccc'
2,100,'xxx'
2,101,'yyy'
1st query: db(db.tblB.fkA == 1).select(db.tblB.name,db.tblB.data)
name,data
100,'aaa'
101,'bbb'
102,'ccc'
2nd query: db(db.tblB.fkA == 2).select(db.tblB.name,db.tblB.data)
name,data
100,'xxx'
101,'yyy'
Thank you guys, I sort of zeroed in on the solution from your replies.
Little by little I am learning how things are done in web2py. :)
tblBalias = db.skedp.with_alias('tblBalias')
desired_result = db(db.tblB.fkA == 1).select(db.tblB.name,
db.tblB.data, tblBalias.data,
left =
To reproduce, create a view with the ff contents:
style type=text/css
td {
border-width: 5px;
border-color: #80;
border-style: solid;
}
/style
{{arr=['second','third']}}
{{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}
HTML result:
table
tbody
tr
tdfirst/td
td/td -- This extra td
this:
{{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}}
Notice the * before the list comprehension -- that converts the list to a
set of positional arguments.
Anthony
On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote:
To reproduce, create a view with the ff
*expression
The syntax appears reasonable to me. Perhaps in the future, developers
would consider allowing this.
On Sep 1, 12:31 pm, Noel Villamor noe...@gmail.com wrote:
Just when I thought I have helped find a bug, I am faced with the
revelation that I need to hone my python some more. He he he
positional argument was a list, so TR wrapped it
in a TD for you (it turned out that your list itself contained two TD's, so
they ended up inside another TD).
Anthony
On Wednesday, August 31, 2011 8:31:09 PM UTC-4, Noel Villamor wrote:
Just when I thought I have helped find a bug, I am faced
Anthony, you surely have another way to killl the cat:
{{=TABLE(TR([TD('first')]+[TD(x) for x in arr]+[TD('fourth')]))}}
Thanks for that.
Noel
On Sep 1, 12:55 pm, Jonathan Lundell jlund...@pobox.com wrote:
On Aug 31, 2011, at 5:50 PM, Noel Villamor wrote:
By the way, the reason why I
Jonathan, you surely have another way to killl the cat:
{{=TABLE(TR([TD('first')]+[TD(x) for x in arr]+[TD('fourth')]))}}
Thanks for that. Anthony, thanks to you as well.
Noel
On Sep 1, 12:55 pm, Jonathan Lundell jlund...@pobox.com wrote:
On Aug 31, 2011, at 5:50 PM, Noel Villamor wrote
Please ignore the above post, as it was submitted prematurely. If a
moderator is around, please delete the post. Thank you.
In chapter 9 there is this view that calls a controller using
getJSON.
VIEW:
script
var xyz;
$(function() {
$.getJSON('{{=URL(r=request,f='weekdays')}}',
function(data){ xyz=data; alert(data); });
$(body).click(function(event) {
['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
I wanted to pass an array from jQuery to a controller.
script
var xyz= ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
$(function() {
$(body).click(function(event) {
call controller here using .getJSON?
});
});
/script
def mycontroller():
# Here, I wanted to receive xyz as
Just got a fresh clone from trunk. Am on Apache2+wsgi.
When clicking the edit button of a view, I get the following at the
browser resulting to a 404 Not Found. Notice the '%2F' which is
supposed to be just '/'.
https://.../admin/default/edit/welcome/views/default%2Findex.html
When clicking
wrote:
Probably due to this recent
fix:http://code.google.com/p/web2py/source/detail?r=c5f6a123b846d9c9c84e2...
On Monday, August 29, 2011 6:49:22 AM UTC-4, Noel Villamor wrote:
Just got a fresh clone from trunk. Am on Apache2+wsgi.
When clicking the edit button of a view, I get
Anthony, your suspicion is confirmed. I reverted to the older gluon/
html.py and the '%2F' issue is gone.
On Aug 29, 11:28 pm, Noel Villamor noe...@gmail.com wrote:
Hmmm ... I can verify this by reverting gluon/html.py to the
2011-08-25 version. What is the command for that in hg
The model:
db.define_table('comment', Field('txt'), Field('tag'))
How do I pass/access the variable xyz, and the txt and tag field
values in funcdone below?
def funcdone(form):
comment_id = form.vars.id
...
def post_comment():
xyz = 123
form = crud.create(db.comment,
,xyz=xyz:funcdone(form,xyz))
return dict(form=form)
On Aug 26, 5:38 am, Noel Villamor noe...@gmail.com wrote:
The model:
db.define_table('comment', Field('txt'), Field('tag'))
How do I pass/access the variable xyz, and the txt and tag field
values in funcdone below?
def
From the manual:
subset=db(db.person.id100)
db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s',
_and=IS_NOT_IN_DB(subset,'person.id'))
Am I right in my interpretation that the dog.owner dropdown will only
show person names who are not in the subset?
Am trying to implement '_and' but
My model has two tables:
db.define_table('tag', Field('name'))
db.define_table('data', Field('title'), Field('tags','list:reference
tag'))
My view for data table has a callback:
{{=form}}
...
ajax(.../tagcallback, [tags], ...)
In my tagcallback controller:
tags = request.vars.tags
...
It seems
I tried inserting crud.settings.formstyle = 'divs' but it only
changed to divs the layout(?) but not the widget.
DEFAULT FORM STYLE
tr id=tag_tags__row
td class=w2p_fl
td class=w2p_fw
table id=tag_tags class=list name=tags
...
FORM STYLE SET TO divs
div id=tag_tags__row
div class=w2p_fl
div
Thanks for the link Anthony, it is what I need. Now, what is the
proper way implement the custom widget? Should I simply copy the code,
make the necessary alterations to it, and insert it in my app's
controller?
Thanks for the tip(s). Have a nice day!
I have this for a field definition:
Field('tags','list:reference
tag',widget=SQLFORM.widgets.checkboxes.widget)
I use crud and it renders the field as an html table, as shown below:
table name=tags id=tag_tags class=listtbody
trtdinput type=checkbox value=12 name=tagsbusiness/td/
tr
trtdinput
52 matches
Mail list logo