]> git.openstreetmap.org Git - osqa.git/blob - forum/management/commands/base_command.py
adding middleware that handles custom pages
[osqa.git] / forum / management / commands / base_command.py
1 #!/usr/bin/env python
2 #encoding:utf-8
3 #-------------------------------------------------------------------------------
4 # Name:        Award badges command
5 # Purpose:     This is a command file croning in background process regularly to
6 #              query database and award badges for user's special acitivities.
7 #
8 # Author:      Mike, Sailing
9 #
10 # Created:     22/01/2009
11 # Copyright:   (c) Mike 2009
12 # Licence:     GPL V2
13 #-------------------------------------------------------------------------------
14
15 from datetime import datetime, date
16 from django.core.management.base import NoArgsCommand
17 from django.db import connection
18 from django.shortcuts import get_object_or_404
19 from django.contrib.contenttypes.models import ContentType
20
21 from forum.models import *
22
23 class BaseCommand(NoArgsCommand):
24     def update_activities_auditted(self, cursor, activity_ids):
25         # update processed rows to auditted
26         if len(activity_ids):
27             query = "UPDATE activity SET is_auditted = 1 WHERE id in (%s)"\
28                     % ','.join('%s' % item for item in activity_ids)
29             cursor.execute(query)
30     
31  
32         
33         
34