1👍
✅
What do you get in bookfile ? Is it an object or an id ? If it’s an id, you could try:
bookfile = form.cleaned_data.get('bookfile')
mybook = MyBook.objects.create(number="5555")
bookFileObject = BookFile.objects.create()
bookFileObject.myfile = bookfile
bookFileObject.save()
mybook.file = bookFileObject
mybook.save()
Source:stackexchange.com