Saturday, February 23, 2019

Re: Editing models in the view: Design advice needed

You'll need to use JavaScript and XHR to send data to the server without refreshing the page. What makes you think the POST would be janky and insecure?

On February 21, 2019 7:27:17 PM CST, Denver Sale <denverstuffsale@gmail.com> wrote:
Hello,

I'm somewhat new to Django/front end web development so I'm wondering what the best way to accomplish this would be. I have a "Rule" model which is made up of a few other models. On the view page, I'd like to list all the Rules with their associated attributes. In each Rule, I'd like the user to be able to edit it and adjust the attributes in the model which is associated with the Rule. Once they click save, I'd like to update the relevant models in the database and reflect that on the page, but I DO NOT want the page to refresh. I know I can do this using a JS library but it seems, from my research, that'd I'd have to create a rather janky and potentially insecure POST request. I could use ModelForms, but I'm unclear how I basically keep the entire page from refreshing rather than just the individual Rule being edited. Any advice on how to accomplish this is GREATLY appreciated. Thanks!

Attached is a mockup of what the UI view would look like. 

No comments:

Post a Comment