First time here? Check out the FAQ!
1

How to delete all notifications?

After migration from Stack Exchange 1, I now have 4588 unread notifications (minor bug in the migration process I guess).

How can I delete them or mark them as read?

When I do it through the normal site interface, all the notifications that are currently seen (~ 20-30) are deleted.

ripper234's avatar
99
ripper234
asked 2012-12-28 09:36:02 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Try this in the django shell (stared by python manage.py shell):

from askbot.models import Activity
from askbot import const

activity_types = (
    const.RESPONSE_ACTIVITY_TYPES_FOR_DISPLAY,
    const.TYPE_ACTIVITY_MENTION,
    const.TYPE_ACTIVITY_MARK_OFFENSIVE,
)
Activity.objects.filter(activity_type__in=activity_types).delete()

If there is something else left, we may have to add more activity types to the lookup list.

Evgeny's avatar
13.2k
Evgeny
answered 2012-12-29 13:55:12 -0600
edit flag offensive 0 remove flag delete link

Comments

This cleaned up all my notifications, but not the count - I still see a red envelope and get a message "you have 4486 new responses". Could you update the snippet to reset this number? (preferably, just reset it to the actual number of responses and not just to zero).

ripper234's avatar ripper234 (2012-12-30 05:06:58 -0600) edit
add a comment see more comments