4

add_form我的 django 应用程序下有一个。我想在这个表单中添加一个功能,它会在用户开始输入后自动保存表单。

就像在 gmail 或 blogger 中一样。

我应该遵循哪些步骤?哪种方式或插件?以及如何使用它们?

任何知识都可以帮助我。谢谢。

4

1 回答 1

7

There's two useful jquery plugins to get you started

https://github.com/BenGriffiths/jquery-save-as-you-type which saves what you type locally to a cookie client-side. Using this plugin is simpler and you will only need to actually save into your django backend when the user hits your form's "save" button.

and

https://github.com/nervetattoo/jquery-autosave which requires that you set up an intermediary model (perhaps a Draft model) in django to keep track of updates along the way. And when the user finally hits save, a final copy of the data is then saved into the actual model.

于 2012-11-20T15:57:02.553 回答