django list_display 和 get_absolute_url
在管理内部,我希望模型的 list_display
包含 get_absolute_url
并且可点击。目前它只显示 /x/
(x 是 ID)。有什么快速解决办法吗?
型号:
def get_absolute_url(self):
return "/%i/" % self.id
管理员:
list_display = ('name', 'get_absolute_url')
Inside admin I want the list_display
of a model to include the get_absolute_url
and be clickable. Currently it just shows /x/
(x being the ID). Any quick fixes?
Model:
def get_absolute_url(self):
return "/%i/" % self.id
Admin:
list_display = ('name', 'get_absolute_url')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)