On Tue, Mar 17, 2009 at 8:34 PM, tristan <[email protected]> wrote:
> A pointer to where I might find the python that deletes an account in
> the "Auth" admin app would be great, because then I could just copy
> that... I've found that does everything I need, but I need to expose
> it to my users so they can do it themselves...

Remember that the auth app is not anything special -- it's an app just
like any of the apps you'd write. It contains a model called `User`
which is, again, a normal Django model, with all the normal Django
model methods -- specifically, `delete()`.

>From the interactive shell, it's easy to delete a user::

    >>> from django.contrib.auth.models import User
    >>> u = User.objects.get(username='jacob')
    >>> u.delete()

So, you'd need to write a view that essentially does the above.
Remember that in views, the currently-logged-in user is available as
`request.user`, so::

    def delete_me(request):
        request.user.delete()
        return render_to_response('youve_been_deleted.html')

You'll probably want to implement some sort of "are you sure?"
confirmation page, but I'll leave that up to you.

Good luck,

Jacob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to