V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
maloneleo88
V2EX  ›  Python

怎么把 JS 嵌入到 django 自带管理后台的页面中?

  •  
  •   maloneleo88 · 2022-04-13 14:37:51 +08:00 · 2048 次点击
    这是一个创建于 715 天前的主题,其中的信息可能已经有所发展或是发生改变。

    是去 django\contrib\admin\templates\admin 里改模板还是 有别的好方法?

    改模板的话我要改自定义 models 类新增数据的页面的话改哪个模板?

    谢谢。

    ps.粉墙越来越厉害了,为了发个贴折腾半天、nmmp

    3 条回复    2022-04-13 23:46:26 +08:00
    lyhapple
        1
    lyhapple  
       2022-04-13 15:56:03 +08:00   ❤️ 1
    项目里新建 templates\admin 目录, 把官方 admin 的 base.html 复制进去,再改一下
    ruanimal
        2
    ruanimal  
       2022-04-13 19:03:20 +08:00
    可以直接扩展 admin 的 template
    maloneleo88
        3
    maloneleo88  
    OP
       2022-04-13 23:46:26 +08:00
    @lyhapple 明白来了 按模板查找优先顺序,, 谢老哥
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1238 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:03 · PVG 02:03 · LAX 11:03 · JFK 14:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.