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.
 
   8 # Author:      Mike, Sailing
 
  11 # Copyright:   (c) Mike 2009
 
  13 #-------------------------------------------------------------------------------
 
  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
 
  21 from forum.models import *
 
  23 class BaseCommand(NoArgsCommand):
 
  24     def update_activities_auditted(self, cursor, activity_ids):
 
  25         # update processed rows to auditted
 
  27             query = "UPDATE activity SET is_auditted = 1 WHERE id in (%s)"\
 
  28                     % ','.join('%s' % item for item in activity_ids)