Save attachment values diff with attached file
parent
ef788d0946
commit
124e2838fb
|
@ -203,6 +203,7 @@ def extract_attachments(obj) -> list:
|
|||
yield {"id": attach.id,
|
||||
"filename": os.path.basename(attach.attached_file.name),
|
||||
"url": attach.attached_file.url,
|
||||
"attached_file": str(attach.attached_file),
|
||||
"thumb_url": thumb_url,
|
||||
"is_deprecated": attach.is_deprecated,
|
||||
"description": attach.description,
|
||||
|
|
|
@ -74,10 +74,11 @@ class TimelineSerializer(serializers.LightSerializer):
|
|||
return obj.data
|
||||
|
||||
def parse_url(self, item):
|
||||
if 'attached_file' in item:
|
||||
attached_file = item['attached_file']
|
||||
else:
|
||||
file_path = urlparse(item['url']).path
|
||||
index = file_path.find('/attachments')
|
||||
attached_file = file_path[index+1:]
|
||||
|
||||
item['url'] = default_storage.url(attached_file)
|
||||
|
||||
return item['url']
|
||||
|
|
Loading…
Reference in New Issue