django cmsplugin_contact
我已经成功安装了 django cmsplugin_contact,但我真正需要的是将表单保存到数据库。我一直在阅读 newForms,但隐含的 python 文件结构相当不同,所以我似乎无法让它工作。
关于如何轻松地将其保存到数据库的任何线索?
我尝试了几种不同的方法,但没有取得好的结果。
非常感谢任何帮助。谢谢。
I have successfully installed the django cmsplugin_contact, but what I really need is for the form to save to the database. I have been reading up on newForms, but the python file structure which is implied is rather different, so I don't seem to make it work.
Any clues as to how to easily make it save to the database?
I've tried several different things, but no good results have come out of it.
Any help is much appreciated. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
顺便说一句,联系人插件非常棒,忘记文档,只需阅读代码,非常简单。
这个线程很旧,但我喜欢这个问题,我想我也需要这样的东西,所以这里有一个答案:
您可以制作一个新的联系人应用程序 smartcontact,它扩展了默认的联系人插件...
联系人插件使用以下形式:
然后您需要做的就是在该应用程序文件夹中创建一个 cms_plugins.py 文件,并扩展联系人应用程序以继承该行为并修复您想要更改的内容。因此,请检查这个未经测试的代码...:
所以我想您需要一个模型来将其保存到其中,并且从上面所需的字段中这将很容易。
不要忘记将新应用添加到 settings.py 并将
plugin_pool.register_plugin(SmartContactPlugin)
粘贴到新 cms_plugins.py 文件的末尾。The contact plugin is excellent by the way, and forget the documentation, just read the code, it's pretty simple.
This thread is old but I like the question and I think I need such a thing too, so here's an answer:
You could make a new contact app, smartcontact, which extends the default contact plugin...
The contact plugin uses this form:
Then all you would need to do is make a cms_plugins.py file inside that app folder, and extend the contacts app to inherit that behavior and just fix what you want to change. So check out this untested code...:
So I guess then you need a model to save that into, and well that would be easy from the fields needed above.
Don't forget to add your new app to settings.py and stick
plugin_pool.register_plugin(SmartContactPlugin)
at the end of your new cms_plugins.py file.如果该插件没有任何文档,您也可以跳过该插件,只使用通过分配给您的页面的 CMS 应用程序挂钩的您自己的视图代码。
If the plugin doesn't have any documentation, you may as well skip the plugin and just use your own view code hooked via a CMS App that is assigned to your page.