Ajax - How to save automatically my Django form

后端 未结 1 1318
不思量自难忘°
不思量自难忘° 2021-02-10 13:36

i have an add_form under my django app. i want to add a feature this form which is saving form automatically after user starts to type.

like in gmail , or

1条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-10 14:25

    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.

    0 讨论(0)
提交回复
热议问题