Guys, thank you, both of you, I have searched hi and low for examples of this and found none. A question, would the example code you have posted behave in the same way as the delete function does in the Auth admin application, in that it would not just delete the user, but also all the profile objects and things like that that are associated with that username?
I got a response in a post here: http://groups.google.com/group/pinax-users/browse_thread/thread/deda8f90e2581bc7/678332bf89130740?lnk=gst&q=delete+usres#678332bf89130740 That mentioned use of a Forien Key to get this data? On Mar 18, 3:16 am, Tim Chase <django.us...@tim.thechases.com> wrote: > > 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. > > I'd also ensure that it's a POST method (you don't want weird > behaviors from caching since data is changed) and that the > confirmation form has some sort of signed token in it (involving > the username to be deleted) to prevent XSS bugs. It would stink > to have a page that deletes users, and could be silently scripted > from remote sites... > > -tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---