Django: generate a CSV file and store it into FileField
问题 In my Django View file, I need to generate a CSV file from a list of tuples and store the CSV file into the FileField of my model. class Bill(models.Model): billId = models.IntegerField() bill = models.FileField(upload_to='bills') I searched on this site, and found some posts such as Django - how to create a file and save it to a model's FileField?, but the solutions can help me. I need the CSV file to be stored in 'media/bills/' fold, and I hope the CSV file can be deleted together with the