Ask Your Question
2

SQL command to delete all users with karma 1

asked 2016-03-05 12:47:09 -0600

kristof gravatar image

updated 2016-06-15 06:19:08 -0600

Evgeny gravatar image

I have more than 2000 user accounts which need to be deleted. In the /admin/ page I cannot filter these users out.

Is there perhaps an SQL command that allows me to delete all the users with karma 1 (or users without any posts).

To be sure -- because I am not very technical -- what is an SQL to backup the database first. And what would be to a SQL command that lists all the users satisfying my criteria. Just want to be sure that I don't delete all users.

Thanks :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
-1

answered 2016-03-09 05:54:15 -0600

Evgeny gravatar image

You might log in to the django shell:

python manage.py shell

Then type :

from askbot.models import User
uu = User.objects.filter(askbot_profile__reputation=1) #or (reputation=1) for versions < 0.8
for u in uu:
    try:
        u.delete()
    except:
        pass
edit flag offensive delete link more

Comments

can it be done with UI?

Andy gravatar imageAndy ( 2016-03-09 21:44:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-05 12:41:58 -0600

Seen: 310 times

Last updated: Mar 09 '16