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.
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
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.
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
Try this,
Delete this
user
I haven't tested, but must work.
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
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
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
8 matches
Mail list logo