Django Rest Framework Unable to Load Fixtures ManyToOneRel не имеет атрибута 'to_python'

Я пытаюсь разработать REST API на основе DRF, у меня есть две модели для этого и одно множество отношений между Автором и Жанром, когда я пытаюсь загрузить некоторые данные в созданные таблицы с помощью приспособлений

[
   {
      "model":"inventory.genre",
      "pk":"1",
      "fields":{
         "tag":"fiction",
         "description":"Fiction is the telling of stories which are not real. More specifically, fiction is an imaginative form of narrative, one of the four basic rhetorical modes. Although the word fiction is derived from the Latin fingo, fingere, finxi, fictum, works of fiction need not be entirely imaginary and may include real people, places, and events. Fiction may be either written or oral. Although not all fiction is necessarily artistic, fiction is largely perceived as a form of art or entertainment. The ability to create fiction and other artistic works is considered to be a fundamental aspect of human culture, one of the defining characteristics of humanity."
      }
   },
   {
      "model":"inventory.genre",
      "pk":"2",
      "fields":{
         "tag":"graphic novel",
         "description":"A graphic novel is a narrative work in which the story is conveyed to the reader using sequential art in either an experimental design or in a traditional comics format. The term is employed in a broad manner, encompassing non-fiction works and thematically linked short stories as well as fictional stories across a number of genres."
      }
   },
   {
      "model":"inventory.author",
      "pk":2,
      "fields":{
         "first_name":"Arthur",
         "last_name":"Golden",
         "author_bio":"Arthur Golden was born in Chattanooga, Tennessee, and was educated at Harvard College, where he received a degree in art history, specializing in Japanese art. In 1980 he earned an M.A. in Japanese history from Columbia University, where he also learned Mandarin Chinese. Following a summer in Beijing University, he worked in Tokyo, and, after returning to the United States, earned an M.A. in English from Boston University. He resides in Brookline, Massachusetts, with his wife and two children.",
         "genre":[
            1
         ]
      }
   }
]

Я получаю ошибку

django.core.serializers.base.DeserializationError: Problem installing fixture '/projects/challenge/seeder.json': 'ManyToOneRel' object has no attribute 'to_python': (inventory.author:pk=2) field_value was '[1]'

Ниже приведены мои модели, которые я разработал

class Author(models.Model):
    # write implementation
    url = models.CharField(max_length=100)
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    author_bio = models.CharField(max_length=500)
    books = models.ForeignKey(Book, on_delete=models.CASCADE, related_name="author", null=True, blank=True)


class Genre(models.Model):
    # TAG Choices
    FICTION = 'F'
    GRAPHIC_NOVEL = 'GN'
    # add more tag options if required
    TAG = (
        (FICTION, 'Fiction'),
        (GRAPHIC_NOVEL, 'Graphic Novel'),
    )
    # write implementation
    description = models.CharField(max_length=800)
    tag = models.CharField(max_length=2, choices=TAG)
    authors = models.ForeignKey(Author, on_delete=models.CASCADE, related_name="genre", null=True)
    books   = models.ForeignKey(Book, on_delete=models.CASCADE, related_name="genre", null=True)
Вернуться на верх