First time here? Check out the FAQ!

Revision history  [back]

Firstly, to prevent future spam enable "premoderation" in the settings -> content moderation section. Enable required email confirmation, this will reduce number of spammers at the site.

Answering your question: Delete users via the django shell. (Note: Before doing this back up your database)

Suppose that the last non-spammer user has id number 256

python manage.py shell
>>> from askbot.models import User
>>> users = User.objects.filter(id__gt=256)
>>> users.delete()
>>> exit()

This will delete the users and all the content they have posted.

Another option is to delete all content and block users (this will mark the content as deleted):

 #select the users as above
 >>> admin = User.objects.get(id=1) #assuming that admin has user id 1
 >>> for user in users:  #iterate through users that you want to block/delete
 ...     admin.delete_all_content_authored_by_user(user) #mark all content as deleted
 ...     user.set_status('b') #block user
 ...     user.save()
 >>> exit()

Firstly, to prevent future spam enable "premoderation" in the settings -> content moderation section. Enable required email confirmation, this will reduce number of spammers at the site.section.

Answering your question: Delete users via the django shell. (Note: Before doing this back up your database)

Suppose that the last non-spammer user has id number 256

python manage.py shell
>>> from askbot.models import User
>>> users = User.objects.filter(id__gt=256)
>>> users.delete()
>>> exit()

This will delete the users and all the content they have posted.

Another option is to delete all content and block users (this will mark the content as deleted):

 #select the users as above
 >>> admin = User.objects.get(id=1) #assuming that admin has user id 1
 >>> for user in users:  #iterate through users that you want to block/delete
 ...     admin.delete_all_content_authored_by_user(user) #mark all content as deleted
 ...     user.set_status('b') #block user
 ...     user.save()
 >>> exit()

Firstly, to prevent future spam enable "premoderation" in the settings -> content moderation section.

Answering your question: Delete users via the django shell. (Note: Before doing this back up your database)

Suppose that the last non-spammer user has id number 256

python manage.py shell
>>> from askbot.models import User
>>> users = User.objects.filter(id__gt=256)
>>> users.delete()
>>> exit()

This will delete the users and all the content they have posted.

Another option is to delete all content and block users (this will mark the content as deleted):

 #select the users as above
 >>> admin = User.objects.get(id=1) #assuming that admin has user id 1
 >>> for user in users:  #iterate through users that you want to block/delete
 ...     admin.delete_all_content_authored_by_user(user) #mark all content as deleted
content
 ...     user.set_status('b') #block user
 ...     user.save()
 >>> exit()