调整报告公开可访问
This commit is contained in:
@@ -445,10 +445,10 @@ class QualityCheck(models.Model):
|
||||
('name', 'like', 'QC-QC') # 根据您的命名规则调整
|
||||
], order='create_date DESC') # 按创建日期降序排序
|
||||
|
||||
# 如果附件数量大于1,则删除除最新报告外的其他报告附件
|
||||
if len(attachments) > 1:
|
||||
for attachment in attachments[1:]:
|
||||
attachment.unlink()
|
||||
# # 如果附件数量大于1,则删除除最新报告外的其他报告附件
|
||||
# if len(attachments) > 1:
|
||||
# for attachment in attachments[1:]:
|
||||
# attachment.unlink()
|
||||
|
||||
# 返回最新的附件(如果存在)
|
||||
return attachments and attachments[0] or False
|
||||
@@ -462,8 +462,8 @@ class QualityCheck(models.Model):
|
||||
latest_attachment = self.get_latest_report_attachment(self.id)
|
||||
if latest_attachment:
|
||||
# 生成包含附件ID的URL
|
||||
print(f"{report_url}/{latest_attachment.id}/datas")
|
||||
return f"{report_url}/{latest_attachment.id}/datas"
|
||||
print(f"{base_url}/quality/report/{latest_attachment.id}")
|
||||
return f"{base_url}/quality/report/{latest_attachment.id}"
|
||||
return False
|
||||
|
||||
def upload_factory_report(self):
|
||||
|
||||
Reference in New Issue
Block a user