from django.core.management.base import BaseCommand, CommandError               
from analytics.report_builder import ReportBuilder


class Command(BaseCommand):
    args = "<subaccount_id> <term_id>"
    help = "Create report of subaccount activity."

    def handle(self, *args, **options):
        report_builder = ReportBuilder()
        
        if len(args) == 2:
            subaccount_id = args[0]
            term_id = args[1]
        else:
            raise CommandError("build_subaccount_activity_report <subaccount_id> <term_id>")

        report_builder.build_subaccount_activity_report(subaccount_id, term_id)

@@ -62,23 +62,8 @@
 rror
-               
 %0Afro
@@ -144,47 +144,8 @@
 d):%0A
-    args = %22%3Csubaccount_id%3E %3Cterm_id%3E%22%0A
     
@@ -192,16 +192,138 @@
 vity.%22%0A%0A
+    def add_arguments(self, parser):%0A        parser.add_argument('subaccount_id')%0A        parser.add_argument('term_id')%0A%0A
     def 
@@ -395,24 +395,16 @@
 ilder()%0A
-        
 %0A       
@@ -408,61 +408,47 @@
     
-if len(args) == 2:%0A            subaccount_id = args%5B0
+subaccount_id = options%5B'subaccount_id'
 %5D%0A  
@@ -453,20 +453,16 @@
         
- 
-   
 term_id 
@@ -467,122 +467,26 @@
 d = 
-args%5B1%5D%0A        else:%0A            raise CommandError(%22build_subaccount_activity_report %3Csubaccount_id%3E %3C
+options%5B'
 term_id
-%3E%22)
+'%5D
 %0A%0A  

use add_arguments