import factory

from . import models


class ChannelFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Channel


class VideoFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Video

import factory

from . import models


class ChannelFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Channel


class VideoFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Video

    channel = factory.SubFactory(ChannelFactory)


class ThumbnailFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Thumbnail

    video = factory.SubFactory(VideoFactory)

Create a factory for Thumbnails.
Create a factory for Thumbnails.

  import factory
  
  from . import models
  
  
  class ChannelFactory(factory.django.DjangoModelFactory):
      FACTORY_FOR = models.Channel
  
  
  class VideoFactory(factory.django.DjangoModelFactory):
      FACTORY_FOR = models.Video
  
+     channel = factory.SubFactory(ChannelFactory)
+ 
+ 
+ class ThumbnailFactory(factory.django.DjangoModelFactory):
+     FACTORY_FOR = models.Thumbnail
+ 
+     video = factory.SubFactory(VideoFactory)
+ 
Create a factory for Thumbnails.
## Code Before:
import factory

from . import models


class ChannelFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Channel


class VideoFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Video

## Instruction:
Create a factory for Thumbnails.
## Code After:
import factory

from . import models


class ChannelFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Channel


class VideoFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Video

    channel = factory.SubFactory(ChannelFactory)


class ThumbnailFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Thumbnail

    video = factory.SubFactory(VideoFactory)
