开发者

Updating part of Django Model without an HTML form

I have a model in django with many fields (almost 40). The model describes a client's underground lawn sprinkler system and, thus, has many attributes (System Owner, install Date, Number of Zones, Valve Box Location, etc.) I am building a webapp for the company to handle their daily business work processes. As a result, I need to display this model to the user (the staff) in a meaningful way so that they can be efficient and obtain the info they need without having to slog through mounds of text fields.

With almost 40 fields, I had to break up the fields on the web page into logical sections. I used a jQuery tab to group similar fields. If I have, say, 10 fields grouped on one tab, I want to let the user change a few fields on that tab, hit save, and carry on. Right now I am using a form and the user hits "save" which is the form's submit button.

Here comes my question: Can I do away with the HTML form and, instead, create "dummy" text input fields with an "a href" link to "Save" the group of fields. The link would be a jQuery function which sends the JSON formatted data to a django view. The view would update the model, and send back a JSON string of "Success" or "Failure" (or something like that). This way, the user saves the data,开发者_运维百科 but doesn't leave the page.

Is this way over the top code wise or would this be a logical way of handling this?

Thanks!


I would just use a button input that uses AJAX to send the data to the server.


Using jquery tabs is a good idea. Here comes the question. How are you going to submit your forms. To increase the usuabilty .you should submit the form using ajax. Jquery form plugin will come in handy for you.In that way the user can stay on the same page during form submission.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜