Search code examples
djangocookiesdjango-1.4

Django delete all cookies for all users


I have the django view to set the value in cookies 'no_show_dialog' when a user clicks 'Don't remind me anymore' in the modal dialog.

Now i changed that dialog completely and want to reset that cookie for all users, so they will have to see it again at least once.

I know there is a way to delete the cookie in a view for a particular user:

response.delete_cookie('no_show_dialog')

But how to loop over all users and remove that cookie once?


Solution

  • You can't do that. Cookies are stored on the client; the only time you have access to them is when the particular browser makes a request and receives the response.

    The best thing to do here is to simply use a different name for the cookie from now on. This will ensure that no users will have it set initially. Alternatively you might consider using the session for future settings.