old_contents: import datetime
  from django.template.defaultfilters import slugify
  from factory import DjangoModelFactory, lazy_attribute
  from random import randint
  
  
  class UserFactory(DjangoModelFactory):
      class Meta:
          model = 'auth.User'
          django_get_or_create = ('username',)
  
      first_name = 'John'
      last_name = 'Doe'
      username = lazy_attribute(
          lambda o: slugify(o.first_name + '.' + o.last_name)
      )
      email = lazy_attribute(lambda o: o.username + "@example.com")
  
      @lazy_attribute
      def date_joined(self):
          return datetime.datetime.now() - datetime.timedelta(
              days=randint(5, 50)
          )
      last_login = lazy_attribute(
          lambda o: o.date_joined + datetime.timedelta(days=4)
      )
  
new_contents: import datetime
  from django.template.defaultfilters import slugify
  from factory import DjangoModelFactory, lazy_attribute
  from random import randint
  from .models import Author
  from .models import Book
  
  
  class UserFactory(DjangoModelFactory):
      class Meta:
          model = 'auth.User'
          django_get_or_create = ('username',)
  
      first_name = 'John'
      last_name = 'Doe'
      username = lazy_attribute(
          lambda o: slugify(o.first_name + '.' + o.last_name)
      )
      email = lazy_attribute(lambda o: o.username + "@example.com")
  
      @lazy_attribute
      def date_joined(self):
          return datetime.datetime.now() - datetime.timedelta(
              days=randint(5, 50)
          )
      last_login = lazy_attribute(
          lambda o: o.date_joined + datetime.timedelta(days=4)
      )
  
  
  class AuthorFactory(DjangoModelFactory):
      class Meta:
          model = Author
          django_get_or_create = ('name',)
  
      name = 'Noam Chomsky'
  
  
  class BookFactory(DjangoModelFactory):
      class Meta:
          model = Book
          django_get_or_create = ('title',)
  
      title = 'Colorless Green Ideas Sleep Furiously'
  
subject: Add AuthorFactory and BookFactory.