0

I have referenced this SO..

Django - how to create a file and save it to a model's FileField?

But I can't quite make out what I'm supposed to do. I am trying to populate a model with initial data and I am getting a FIELDFILE...I strip all of the other attributes and I am just getting the FIELDFILE name. I am trying to save it to a model using inlineformsets...but it won't save.

I tried to override my SAVE method in my form...as shown below just as an experiment...

def save(self, update_author, *args, commit=True, **kwargs):
    f = open('/path/to/file')
    self.attachments.save(book, File(f))

But it does nothing. Thanks in advance for any pointers.

Steve Smith
  • 833
  • 3
  • 11
  • 29

0 Answers0