Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想禁止在 Django 管理员中默认为日期字段提供的今天链接。
您最好的解决方案是将管理员中使用的 DateField 小部件子类化并调整 render() 方法以不显示链接。
您可以在此处找到对小部件进行子类化的一般方法的示例:
为了让该小部件在管理员中使用,您可以在相关应用程序的 admin.py 中进行设置。这是有关如何执行此操作的官方文档