如何将填充了数据(大约15列和2500行)的整个模型导出到excel文件中,以便通过html页面中的按钮直接下载?
这是我的模特:
class Cleartobill(models.Model):
soss = models.CharField(max_length=60)
soss_line = models.CharField(max_length=70)
build_date = models.CharField(max_length=80)
ctb_Status = models.CharField(max_length=60)
ctb_comment = models.CharField(max_length=50)
comments = models.CharField(max_length=200)
sjz_status = models.CharField(max_length=60)
production_result_Code = models.CharField(max_length=70)
bu = models.CharField(max_length=50)
pf = models.CharField(max_length=50)
current_fcd = models.DateField(null=True, blank=True)
tan = models.CharField(max_length=50)
eta = models.CharField(max_length=60, null=True, blank=True)
tied = models.CharField(max_length=30)
otm_status = models.CharField(max_length=30)
bucket_aged = models.CharField(max_length=60)
ead = models.DateField(null=True, blank=True)