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)
- https://code.google.com/p/web2py/
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:
> >
> >
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( ...
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
que every time you
> instantiate a new PluginMModal -- even if you called it twice 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 wor
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 web2
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 wrote:
#x27;t deceive me, I do see *** in three locations.
:)
Noel
On Sep 14, 10:25 am, Anthony 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 ***?
I got the * and the ** explanations but António is asking about ***.
On Sep 14, 5:51 am, Anthony 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 list were passed
Thanks Jan.
On Sep 12, 8:47 pm, "jot.be" wrote:
> Hi,
>
>
>
>
>
>
>
>
>
> On Mon, Sep 12, 2011 at 4:57 AM, Noel Villamor wrote:
> > I have a button which does the following callback:
>
> > ajax('{{=URL('callback')}}
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
wrote:
> Not really server side intensive, mostly client side but fun project.
>
> http://tests.web2py.com/physics2d
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 coo
Thank you guys!
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 ta
I am dissecting gluon/contrib/spreadsheet.py and I am trying to
understand the ff:
class Sheet:
def __init__(self, rows, cols, url='.', readonly=False,
active=True,
onchange=None):
self.rows = rows
self.cols = cols
self.url = url
self.nodes =
for item in mylist:
> 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 wrote:
>
>
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 Se
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 as
nce 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
>
>
>
>
>
>
>
> O
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)
Title is well deserved! Congratulations to the team.
Thanks for the info Anthony.
Denes, you just added a trick to my python arsenal. TY.
Noel
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 wrote:
> Hi.
>
> I found in 1.98.2, text field type default length is 512 not 65536?
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 python
I see. So that explains the backtracking when two dots are in the URL
(similar behaviour to cd .. at the command line).
I found this for you:
http://www.plus2net.com/html_tutorial/button-linking.php
Try this:
Noel
On Sep 6, 7:07 am, Fabiano Faver wrote:
> I'm tryng to put a button thaat calls a action which in the end will
> redirect to another page. but its like the function is not known.
>
> I've tryed in v
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 t
}"+args ,[],'target');
On Aug 31, 6:18 pm, Bruno Rocha 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 wrote:
> > I wanted to pass an array from jQuery to a controll
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 = tblBalias.o
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'
Desi
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 == 1).select(db.tblB.name,db.t
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 wrote:
> On Aug 31, 2011, at 5:50 PM, Noel Villamor wrot
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 wrote:
> On Aug 31, 2011, at 5:50 PM, Noel Villamor wrote:
>
>
>
> > By
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 wro
axError: only named arguments may follow *expression
The syntax appears reasonable to me. Perhaps in the future, developers
would consider allowing this.
On Sep 1, 12:31 pm, Noel Villamor wrote:
> Just when I thought I have helped find a bug, I am faced with the
> revelation that I need to
nstead, try 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:0
To reproduce, create a view with the ff contents:
td {
border-width: 5px;
border-color: #80;
border-style: solid;
}
{{arr=['second','third']}}
{{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}
HTML result:
first
<-- This extra td should not be here
second
third
Remarks:
Th
I wanted to pass an array from jQuery to a controller.
var xyz= ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
$(function() {
$("body").click(function(event) {
<< call controller here using .getJSON? >>
});
});
def mycontroller():
# Here, I wanted to receive xyz as an arra
In chapter 9 there is this view that calls a controller using
getJSON.
VIEW:
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']
Please ignore the above post, as it was submitted prematurely. If a
moderator is around, please delete the post. Thank you.
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 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?
&
bly 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.
>
> > Wh
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
xyz=xyz:funcdone(form,xyz))
> return dict(form=form)
>
> On Aug 26, 5:38 am, Noel Villamor wrote:
>
>
>
>
>
>
>
> > The model:
>
> > db.define_table('comment', Field('txt'), Field('tag'))
>
> > How do I pass
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, onaccept=func
>From the manual:
subset=db(db.person.id>100)
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' bu
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 see
Thanks for the tip(s). Have a nice day!
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?
I tried inserting crud.settings.formstyle = 'divs' but it only
changed to divs the layout(?) but not the widget.
DEFAULT FORM STYLE
...
FORM STYLE SET TO "divs"
...
As mentioned in my original post, I wanted
to be
.
Any other suggestion? Thanks again.
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:
business
family
friend
How do I customize the rendering into:
business
family
friend
Thanks in advance.
52 matches
Mail list logo