django admin 自定义替换change页面模板的方法

yipeiwu_com6年前Python基础

举个简单的例子:(此仅限于修改change_form页面)

原来的时候,change_form_list是包含这些按钮的:

因为此页面继承了

{% extends 'admin/change_form.html' %}

所以,可以将admin/change_form.html 拷贝到指定目录,然后重新指定继承模板。

{% extends 'admin/englishwordlibrary/recitequestion/change_form.html' %}

然后我在admin/englishwordlibrary/recitequestion/change_form.html 更改页面样式,删除相应按钮和菜单。最后效果就是:

以上这篇django admin 自定义替换change页面模板的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Python 函数基础知识汇总

一、函数基础 简单地说,一个函数就是一组Python语句的组合,它们可以在程序中运行一次或多次运行。Python中的函数在其他语言中也叫做过程或子例程,那么这些被包装起来的语句通过一个函...

通过数据库向Django模型添加字段的示例

首先借用书本(book)的这个数据模型: from django.db import models class Publisher(models.Model): name =...

pow在python中的含义及用法

pow()方法返回xy(x的y次方) 的值 语法 以下是math模块pow()方法的语法: import math math.pow( x, y ) 内置的pow()方法 p...

python aiohttp的使用详解

python aiohttp的使用详解

1.aiohttp的简单使用(配合asyncio模块) import asyncio,aiohttp async def fetch_async(url): print(url)...

python3的UnicodeDecodeError解决方法

python3的UnicodeDecodeError解决方法

爬虫部分解码异常 response.content.decode() # 默认使用 utf-8 出现解码异常 以下是设计的通用解码 通过 text 获取编码 # 通过...