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 ca
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
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:
-
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:
ro
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
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 wrote:
> something like this should work:
>
> my_object = db(db[table_name]['id']==my_id).select().first()
>
> If you use brackets instead of dot
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 instead:
db[key].id not workin??
Richard
On Mon, Feb 21, 2011 at 3:16 PM, LightOfMooN 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] = db(db.KEY.id=='some_id
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
[
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.
Hi,
I want to change the value of a variable by clicking on an 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
Hi,
I want to change the value of a variable by clicking on an 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
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 wi
13 matches
Mail list logo