[web2py] Re: How to delete a user?

2011-01-02 Thread pbreit
Be careful deleting users with an href since that can easily lead to unintended deletions. In general links and GETs should never add, update or delete anything.

[web2py] Re: How to delete a user?

2011-01-02 Thread Rick
Thanks a lot! I find this being a good solution: ==in admin.html== {{=A(("Delete this user"), _href=URL('deleteusr'))}} ==in the controller file== def deleteusr(): db(custom_auth_table.username==session.username).delete() redirect(URL('admin')) On Jan 2, 8:19 pm, Jonathan Lundell

Re: [web2py] Re: How to delete a user?

2011-01-02 Thread Jonathan Lundell
On Jan 2, 2011, at 11:10 AM, Arun K.Rajeevan wrote: > Try this, > Delete this > user > > I haven't tested, but must work. If I were coding this for myself, I think I'd self-submit and conditionally do the user-delete and redirect in the original controller.

Re: [web2py] Re: How to delete a user?

2011-01-02 Thread Jonathan Lundell
On Jan 2, 2011, at 11:04 AM, Rick wrote: > > Thanks, I changed the code to this: > Users: > > ==in admin.html== > > {{for record in records:}} > {{=record.username}} : {{=record.password}} > [ > {{session.username=record.username}} > Delete this > user > ] > {{pass}} > > > ==in a controller fi

[web2py] Re: How to delete a user?

2011-01-02 Thread Arun K.Rajeevan
Try this, Delete this user I haven't tested, but must work.

[web2py] Re: How to delete a user?

2011-01-02 Thread Rick
Thanks, I changed the code to this: Users: ==in admin.html== {{for record in records:}} {{=record.username}} : {{=record.password}} [ {{session.username=record.username}} Delete this user ] {{pass}} ==in a controller file== def deleteusr(): db(custom_auth_table.username==session.usernam

Re: [web2py] Re: How to delete a user?

2011-01-02 Thread Jonathan Lundell
On Jan 2, 2011, at 7:01 AM, Rick wrote: > > I changed the code but it still doesn't work: Here's a fragment of my code that I use to delete a user. It's not ajax, but you'll get the idea: ut = auth.settings.table_user uu = urow.auth_user ... if no

[web2py] Re: How to delete a user?

2011-01-02 Thread Rick
I changed the code but it still doesn't work: ==admin.html== {{extend 'layout.html'}} Add a user: {{=form}} Users: {{for record in records:}} {{=record.username}} : {{=record.password}} [ Delete this user ] {{pass}} ==Here is some code from models/db.py== auth = Auth(globals(), db