from django.core.management.base import BaseCommand

from greenfan.models import TestSpecification


class Command(BaseCommand):
    def handle(self, ts_id, **options):
        ts = TestSpecification.objects.get(id=ts_id)
        job = ts.create_job()

        return 'Created job %d' % job.pk

from django.core.management.base import BaseCommand

from greenfan.models import TestSpecification


class Command(BaseCommand):
    def handle(self, ts_id, **options):
        ts = TestSpecification.objects.get(id=ts_id)
        physical = 'physical' in options
        job = ts.create_job(physical=physical)
        return 'Created job %d' % job.pk

Allow us to create both virtual and physical jobs
Allow us to create both virtual and physical jobs

  from django.core.management.base import BaseCommand
  
  from greenfan.models import TestSpecification
  
  
  class Command(BaseCommand):
      def handle(self, ts_id, **options):
          ts = TestSpecification.objects.get(id=ts_id)
+         physical = 'physical' in options
-         job = ts.create_job()
+         job = ts.create_job(physical=physical)
- 
          return 'Created job %d' % job.pk
  
Allow us to create both virtual and physical jobs
## Code Before:
from django.core.management.base import BaseCommand

from greenfan.models import TestSpecification


class Command(BaseCommand):
    def handle(self, ts_id, **options):
        ts = TestSpecification.objects.get(id=ts_id)
        job = ts.create_job()

        return 'Created job %d' % job.pk

## Instruction:
Allow us to create both virtual and physical jobs
## Code After:
from django.core.management.base import BaseCommand

from greenfan.models import TestSpecification


class Command(BaseCommand):
    def handle(self, ts_id, **options):
        ts = TestSpecification.objects.get(id=ts_id)
        physical = 'physical' in options
        job = ts.create_job(physical=physical)
        return 'Created job %d' % job.pk
