我在下面有以下型号。我想压缩上传的文档,然后在POST
请求完成后提供解压缩文件的链接。如何在基于类的视图中使用lz4
来压缩或解压缩包含图像的有效负载?
class EmployeeDocument(models.Model):
"""
Model, Which holds Employee documents uploaded.
"""
employee = models.ForeignKey(
Employee, related_name="employee_docs", null=True, blank=True)
document = models.FileField(
upload_to='Images/', default='Images/None/No-img.jpg')
details = models.TextField()
def __str__(self):
return 'DOC - %s' % (self.employee.user.username)