修复后台附件地址链接错误的问题

This commit is contained in:
yangjian 2023-05-19 09:12:31 +08:00
parent 8b4effda23
commit 56c5d5d03f
2 changed files with 2 additions and 5 deletions

View File

@ -101,6 +101,7 @@ class ImageGroupSerializer(ModelSerializer):
# 附件序列化器
class AttachmentSerializer(ModelSerializer):
file_path = serializers.CharField()
username = serializers.SerializerMethodField(label="用户名")
class Meta:

View File

@ -48,11 +48,7 @@
<!-- 附件名 -->
<script type="text/html" id="fileName">
{% verbatim %}
{{#if (d.file_path.startsWith('attachment')) { }}
<a href="/media/{{d.file_path}}" target="_blank">{{d.file_name}}</a>
{{# }else{ }}
<a href="{{decodeURI(d.file_path.replace('/media/',''))}}" target="_blank" >{{ d.file_name }} </a>
{{# } }}
<a href="/media/{{decodeURI(d.file_path)}}" target="_blank" >{{ d.file_name }} </a>
{% endverbatim %}
</script>