为什么 save_model 方法在 admin.StackedInline 中不起作用?
我有一个与我之前解决的问题类似的问题,除了这次解决方案似乎不起作用:
如何在 django admin 中创建对象时自动插入当前用户?
以前我曾经重写 save_model 来标记用户提交文章。现在我需要对评论做同样的事情,它似乎不再起作用了。
有人有什么想法吗?
多谢!
贾森
I have a similar problem as a previously solved problem of mine, except this time solution doesn't seem to work:
How to auto insert the current user when creating an object in django admin?
Previously i used to override the save_model to stamp the user submitting the article. Now i need to do the same for comments, it doesn't seem to work anymore.
Anyone have any ideas?
Thanks a lot!
Jason
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
保存不是在 InlineAdmin 的
save_form
中完成的,您必须查看内联所属的 ModelAdmin 中的save_formsets
:The saving isn't done in the InlineAdmin's
save_form
, you have to look atsave_formsets
in the ModelAdmin to which the inlines belong: