镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion xadmin/views/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ def label(self):
self.text) if self.allow_tags else conditional_escape(self.text)
if force_text(text) == '':
text = mark_safe(' ')

def rreplace(s, old, new, occurrence):
li = s.rsplit(old, occurrence)
return new.join(li)
# 修复wrap存在中文转义,报错,修改链接内容不展示的问题
for wrap in self.wraps:
text = mark_safe(wrap % text)
if len(wrap.split("%")) > 2:
text = mark_safe(rreplace(wrap, '%s', text, 1))
else:
text = mark_safe(wrap % text)
return text

@property
Expand Down