How to send multiple files to backend via GraphQL in Django

I have this code:

test_image = SimpleUploadedFile(name='test.jpg', content=b'test')

response = self.file_query(
    mutation createBook($input: BookMutationInput!) {
        createBook(input: $input) {
            book {id}
       "name": "Test Book",
       "description": "Test Description",
       "pages": [
           {"name": "Page 1"},
           {"name": "Page 2"}
   files={'image': test_image},

test_image belongs to Book instance. But each page should also contain an image. How can I pass these images for each page in this payload to backend?

Back to Top