5

I want to delete all cookies for the user under my domain name. I know logout() method removes the session, but it seems like some of my apps are generating a few more cookies that needs to be cleansed. How can I achieve this?

the
  • 21,007
  • 11
  • 68
  • 101
Hellnar
  • 62,315
  • 79
  • 204
  • 279
  • 8
    Sorry but this was just perfect: http://farm3.static.flickr.com/2359/2534644455_4cb78c0d2c.jpg – Travis Feb 19 '10 at 21:25
  • 2
    possible duplicate of [Django logout(redirect to home page) .. Delete cookie?](http://stackoverflow.com/questions/1275357/django-logoutredirect-to-home-page-delete-cookie) – Olli Feb 11 '14 at 14:10
  • 1
    Not a duplicate, since that question asks about a single cookie, not all cookies. – Tyson May 25 '18 at 02:12

2 Answers2

2

Check out this question. I think there's an answer for you there.

Community
  • 1
  • 1
Travis
  • 12,001
  • 8
  • 39
  • 52
0

This is a late answer, but:

def some_view(request):
    response = HttpResponseRedirect('/any-page-you-want/')
    for cookie in request.COOKIES:
        response.delete_cookie(cookie)
    return response
Sid
  • 2,174
  • 1
  • 13
  • 29