[web2py] Re: crud newbie question regarding update [ALMOST THERE]

2010-01-29 Thread weheh
OK, I see the problem. The .id link created by crud.select points to the default controller. I need it to point to admin. What's the method for informing crud to do that? Obviously, I can do a redirect, but that seems kludgy. Why wouldn't crud.select automatically set the controller to be the same

[web2py] Re: crud newbie question regarding update [ALMOST THERE]

2010-01-29 Thread weheh
On Jan 29, 1:40 pm, weheh wrote: > OK, I see the problem. The .id link created by crud.select points to > the default controller. I need it to point to admin. What's the method > for informing crud to do that? Obviously, I can do a redirect, but > that seems kludgy. Why wouldn't crud.select auto

[web2py] Re: crud newbie question regarding update

2010-01-29 Thread weheh
OK, I see the problem. The .id link created by crud.select points to the default controller. I need it to point to admin. What's the method for informing crud to do that? Obviously, I can do a redirect, but that seems kludgy. Why wouldn't crud.select automatically set the controller to be the same

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
Oh, Massimo, one other thing. The crud.select is returning the auth.user.id, whereas I would like to get auth.user.email in the rows listing. How would I go about doing that? My db.content table has a field named email: Field('user',db.auth_user,requires=IS_IN_DB(db,'auth_user.id','%(email) s'))

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
The URL is automatically generated by the crud.select and is attached to the record id. Here's the URL: http://127.0.0.1:8000/spin/default/marketing/read/content/4 -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send emai

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
http://127.0.0.1:8000/spin/default/junk/read/content/4 -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.c

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread mdipierro
what is the url that gives you invalid record? What is in request.url? with args(2) and not args(0)? On Jan 28, 7:20 pm, weheh wrote: > Hi Massimo, I'm sorry, but I don't understand how to do this. I tried > the following: > > #controller > def junk(): >   form = crud.update(db.content,request.ar

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
Hi Massimo, I'm sorry, but I don't understand how to do this. I tried the following: #controller def junk(): form = crud.update(db.content,request.args(2),next=request.url) rows=crud.select(...) return dict(form=form,rows=rows) Record creation works OK. But when I click on a rows record id,

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread mdipierro
request.args[0] fails if there is no request.args. request.args(i) never fails returns None instead. If you pass None as second argument to crud.update it behaves as crud.create. ;-) On Jan 28, 2:33 pm, weheh wrote: > Massimo, I don't see how that could possibly work if there's no > request.args(

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
Massimo, I don't see how that could possibly work if there's no request.args(0)? In fact, I tried it and got an "invalid function" error. Wouldn't I first have to test not len(request.args(0)) and if True then create else update? This seems obvious, but it seems that crud is so compact that it migh

[web2py] Re: crud newbie question regarding update

2010-01-28 Thread mdipierro
form = crud.update(db.person, request.args(0), ...) this will do an update if you have http://.../action/[id] and a create if http://.../action On Jan 28, 1:53 am, weheh wrote: > changing subject line -- You received this message because you are subscribed to the Google Groups "web2py-users"