当您将价格从Django传递给onclick时,这是一个问题。
admin.py
class CommCdInfoAdmin(admin.ModelAdmin):
class Media:
js = (
'https://ajax.googleapis.com/ajax/libs/d3js/5.7.0/d3.min.js', # jquery
'js/comcdInfoscript.js', # app static folder
)
list_display = ('comm_gpcd', 'comm_cd', 'comm_cd_nm', 'comm_use_yn', 'comm_sort', 'register_date', 'status',)
def status(self, obj):
if obj.comm_use_yn != "":
html = "<input type='button' value='edit' onclick='CommCdInfoAdmin_edit({0}, {1})'>"
return format_html(html, obj.comm_gpcd, obj.comm_cd)
是这部分的结果
<input type="button" value="edit" onclick="CommCdInfoAdmin_edit(sns, K)">
我想更改它。出来如下。
<input type="button" value="edit" onclick="CommCdInfoAdmin_edit('sns','K')">
''<-----如何添加它?