[web2py] variables available in view

2016-02-19 Thread Pierre
hi everyone, I have a controller/function with different return cases: like : if condition1: return dict(var1=var1) elif condition2: return dict(var1=var1,var2=var2) . how do I know in the corresponding view which variables are accessible (what's the case) ? do I have to return a

[web2py] variables outside any function

2015-04-15 Thread Annet
In a controller I got functions that use the same variables. I want to assign a value to them outside any function: if request.args(0) == 'openinghours': rdrctUrl = URL('opening_hours') function_header = 'Opening hours' function_icon = 'fa-clock-o' table = db.cal_opening_hours elif

[web2py] Variables from url

2014-01-24 Thread Lucas Schreiber
Hi, I have a question: For example, somebody opens this page: .../profile/1 Now, in the def profile(): there shall be a variable: a=1 Or, when this page gets opened: .../profile/12345 I wish this variable: a=12345 Is it possible to do this in web2py? Can you explain me how? -- Resources: -

[web2py] variables to determine table columns from database

2012-08-07 Thread Larry Wapnitsky
from a web page, i'm able to successfully query my database using the following: rows = db(db[request.args(0)].id == request.args(1)).select( What I'm having trouble with is passing another argument that specifies another column other than id. I've tried the following with no success:

[web2py] Variables in javascript function.

2011-04-22 Thread annet
In web2py_ajax.html I have the following function: function details(url) { detailswindow=window.open(url,'details','toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=792,height=696'); if (window.focus) detailswindow.focus(); return false; } ... which

Re: [web2py] Variables in queries

2011-02-22 Thread Ross Peoples
something like this should work: my_object = db(db[table_name]['id']==my_id).select().first() If you use brackets instead of dot notation for table names, you may not be able to use dot notation for the field name. I don't know for sure, but instead of doing this: db[key].id Try this

Re: [web2py] Variables in queries

2011-02-22 Thread Richard Vézina
No, it works... I do not know if it should be like this and if it will be always the case... Richard On Tue, Feb 22, 2011 at 10:48 AM, Ross Peoples ross.peop...@gmail.comwrote: something like this should work: my_object = db(db[table_name]['id']==my_id).select().first() If you use

[web2py] Variables in queries

2011-02-21 Thread LightOfMooN
Is there a way to use variables in queries as table names? For example, something like this: keys = ['table1','table2','table3'] mydict = {} for key in keys: mydict[key] = db(db.KEY.id=='some_id').select() where key is a name of table.

Re: [web2py] Variables in queries

2011-02-21 Thread Bruno Rocha
Yes, this is used in crud and appadmin db['tablename']['fieldname'] keys = ['table1','table2','table3'] mydict = {} for key in keys: mydict[key] = db(*db[key]['id']*=='some_id').select() -- Bruno Rocha

Re: [web2py] Variables in queries

2011-02-21 Thread Richard Vézina
db[key].id not workin?? Richard On Mon, Feb 21, 2011 at 3:16 PM, LightOfMooN vladsale...@yandex.ru wrote: Is there a way to use variables in queries as table names? For example, something like this: keys = ['table1','table2','table3'] mydict = {} for key in keys: mydict[key] =

[web2py] variables

2010-12-17 Thread Rick
Hi, I want to change the value of a variable by clicking on an a tag, but can't find any information about the topic. I suppose the code would look something like this: {{=A('', request n=n-1) }} Thanks in advance for help

[web2py] variables

2010-12-17 Thread Rick
Hi, I want to change the value of a variable by clicking on an a tag, but can't find any information about the topic. I suppose the code would look something like this: {{=A('', request n=n-1) }} Thanks in advance for help

[web2py] variables turning into lists

2010-06-02 Thread Andrew Buchan
Hello, I've had this issue before, where a string which is passed as part of request.vars somehow becomes a list when the form is submitted. The way I got round it at the time was by doing: if isinstance(thread_id, list): thread_id = thread_id[0] However, that just doesn't feel right, and