コード例 #1
0
    def handle(self, *args, **options):
        """
    Add confirmation codes for the specified activities.
    """
        # If we don't have any args, find all activities with confirmation type code.
        if len(args) < 2:
            self.stdout.write(
                'Usage: python manage.py add_codes <num_codes> <slug1, slug2, ...>\n'
            )
            return

        num_codes = 0
        try:
            num_codes = int(args[0])
        except ValueError:
            self.stdout.write('%s is not a valid integer\n' % args[0])

        activities = Activity.objects.filter(slug__in=args[1:])
        for activity in activities:
            if activity.confirm_type != 'code':
                self.stdout.write("ERROR: '%s' has confirmation type %s" %
                                  (activity.title, activity.confirm_type))
            else:
                self.stdout.write(
                    "Generating %d additional codes for '%s'.\n" %
                    (num_codes, activity.title))
                ConfirmationCode.generate_codes_for_activity(
                    activity, num_codes)
コード例 #2
0
ファイル: regenerate_codes.py プロジェクト: keokilee/makahiki
 def _regenerate_codes(self, activities):
   for activity in activities:
     if not activity.confirm_type == 'code':
       self.stdout.write("ERROR: '%s' has confirmation type %s\n" % (activity.title, activity.confirm_type))
       return
     
     # Generate confirmation codes based on the capacity of this activity
     num_codes = activity.event_max_seat
     
     if not num_codes or num_codes == 0:
       self.stdout.write("ERROR: '%s' has event_max_seat of %d\n" % (activity.title, num_codes))
       return
       
     # Delete confirmation codes for this activity
     self.stdout.write("Deleting old codes for '%s'\n" % activity.title)
     ConfirmationCode.objects.filter(activity=activity).delete()
     
     self.stdout.write("Generating new codes for '%s'\n" % activity.title)
     ConfirmationCode.generate_codes_for_activity(activity, num_codes)
コード例 #3
0
ファイル: add_codes.py プロジェクト: keokilee/makahiki
 def handle(self, *args, **options):
   """
   Add confirmation codes for the specified activities.
   """
   # If we don't have any args, find all activities with confirmation type code.
   if len(args) < 2:
     self.stdout.write('Usage: python manage.py add_codes <num_codes> <slug1, slug2, ...>\n')
     return
   
   num_codes = 0
   try:
     num_codes = int(args[0])
   except ValueError:
     self.stdout.write('%s is not a valid integer\n' % args[0])
     
   activities = Activity.objects.filter(slug__in=args[1:])
   for activity in activities:
     if activity.confirm_type != 'code':
       self.stdout.write("ERROR: '%s' has confirmation type %s" % (activity.title, activity.confirm_type))
     else:
       self.stdout.write("Generating %d additional codes for '%s'.\n" % (num_codes, activity.title))
       ConfirmationCode.generate_codes_for_activity(activity, num_codes)
コード例 #4
0
ファイル: regenerate_codes.py プロジェクト: ilwoof/makahiki
    def _regenerate_codes(self, activities):
        for activity in activities:
            if not activity.confirm_type == 'code':
                self.stdout.write("ERROR: '%s' has confirmation type %s\n" %
                                  (activity.title, activity.confirm_type))
                return

            # Generate confirmation codes based on the capacity of this activity
            num_codes = activity.event_max_seat

            if not num_codes or num_codes == 0:
                self.stdout.write("ERROR: '%s' has event_max_seat of %d\n" %
                                  (activity.title, num_codes))
                return

            # Delete confirmation codes for this activity
            self.stdout.write("Deleting old codes for '%s'\n" % activity.title)
            ConfirmationCode.objects.filter(activity=activity).delete()

            self.stdout.write("Generating new codes for '%s'\n" %
                              activity.title)
            ConfirmationCode.generate_codes_for_activity(activity, num_codes)