Commit 6004f011 authored by Claude Paroz's avatar Claude Paroz

Move maintenance tasks in a management command

parent 00809243
......@@ -63,6 +63,13 @@ Installation
4 - Download jQuery and tablesorter .min.js files and copy them in
/media/js directory. Rename jquery-x.y.z.min.js into jquery.min.js
Maintenance tasks
=================
There is a management command to run maintenance tasks (clean never-activated
accounts, inactivate unused roles, ...):
./manage.py run-maintenance
It might be useful to add the command in a cron schedule.
OpenID support
==============
......
......@@ -118,8 +118,4 @@ def activate_account(request, key):
except Person.DoesNotExist:
return render_to_response('error.html', {'error':"Sorry, the key you provided is not valid."})
person.activate()
#TODO: Here does not seem to be a good place for this.
# We should move this in a cron-like system
Person.clean_unactivated_accounts()
Role.inactivate_unused_roles()
return site_login(request, msgs=[_("Your account has been activated.")])
from django.core.management.base import BaseCommand
from people.models import Person
from teams.models import Role
class Command(BaseCommand):
help = "Run maintenance tasks"
def handle(self, *args, **options):
Person.clean_unactivated_accounts()
Role.inactivate_unused_roles()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment