นี่คือโมเดลของฉัน สิ่งที่ฉันต้องการทำคือสร้างไฟล์ใหม่และเขียนทับไฟล์ที่มีอยู่ทุกครั้งที่บันทึกอินสแตนซ์โมเดล:
class Kitten(models.Model):
    claw_size = ...
    license_file = models.FileField(blank=True, upload_to='license')
    def save(self, *args, **kwargs):
        #Generate a new license file overwriting any previous version
        #and update file path
        self.license_file = ???
        super(Request,self).save(*args, **kwargs)
ฉันเห็นเอกสารมากมายเกี่ยวกับวิธีอัปโหลดไฟล์ แต่ฉันจะสร้างไฟล์กำหนดให้กับฟิลด์โมเดลและให้ Django จัดเก็บในตำแหน่งที่ถูกต้องได้อย่างไร