Skip to content

Instantly share code, notes, and snippets.

@gt11799
Last active August 2, 2017 13:02
Show Gist options
  • Select an option

  • Save gt11799/760251b93236e099a6594456621a57e9 to your computer and use it in GitHub Desktop.

Select an option

Save gt11799/760251b93236e099a6594456621a57e9 to your computer and use it in GitHub Desktop.
如果修改django admin页面的右上角按钮
{% extends "admin/change_list.html" %}
{% block object-tools-items %}
<script>
function export_file() {
var export_url = '/export';
var url = window.location.href;
var params = url.split('?')[1];
if (typeof(params) == undefined) {
export_url += '?' + params;
};
window.open(export_url);
}
</script>
<li>
<a href="#" class="grp-state-focus" onclick="export_file()">导出</a>
</li>
{{ block.super }}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment