from django.core.management.base import NoArgsCommand

from scraper.models import Source


class Command(NoArgsCommand):
    """ Crawl all active resources """

    def handle_noargs(self, **options):
        sources = Source.objects.filter(active=True)
        for source in sources:
            source.crawl()

from django.core.management.base import NoArgsCommand

from scraper.models import Spider


class Command(NoArgsCommand):
    """ Crawl all active resources """

    def handle_noargs(self, **options):
        spiders = Spider.objects.all()
        for spider in spiders:
            spider.crawl_content()

Update management command to adapt new model
Update management command to adapt new model

  from django.core.management.base import NoArgsCommand
  
- from scraper.models import Source
+ from scraper.models import Spider
  
  
  class Command(NoArgsCommand):
      """ Crawl all active resources """
  
      def handle_noargs(self, **options):
-         sources = Source.objects.filter(active=True)
-         for source in sources:
-             source.crawl()
+         spiders = Spider.objects.all()
+         for spider in spiders:
+             spider.crawl_content()
  
Update management command to adapt new model
## Code Before:
from django.core.management.base import NoArgsCommand

from scraper.models import Source


class Command(NoArgsCommand):
    """ Crawl all active resources """

    def handle_noargs(self, **options):
        sources = Source.objects.filter(active=True)
        for source in sources:
            source.crawl()

## Instruction:
Update management command to adapt new model
## Code After:
from django.core.management.base import NoArgsCommand

from scraper.models import Spider


class Command(NoArgsCommand):
    """ Crawl all active resources """

    def handle_noargs(self, **options):
        spiders = Spider.objects.all()
        for spider in spiders:
            spider.crawl_content()
