]> git.openstreetmap.org Git - osqa.git/blob - forum/management/commands/base_command.py
initial import
[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 from forum.const import *
23
24 class BaseCommand(NoArgsCommand):
25     def update_activities_auditted(self, cursor, activity_ids):
26         # update processed rows to auditted
27         if len(activity_ids):
28             query = "UPDATE activity SET is_auditted = 1 WHERE id in (%s)"\
29                     % ','.join('%s' % item for item in activity_ids)
30             cursor.execute(query)
31     
32  
33         
34         
35