Table/Data architecture

Hi all,

I need some tips about the table implementation in Django.
In my project, I’ve some models to store the data, and I would like to:

  • show the data on my template;
  • use three buttons, one to add a row, the second to delete the row and the other to save the data.

I’ve already created a class on JavaScript to create a table using a dictionary.
I’m new to Django (and the development), and I need to understand how I can architected the page. In my mind, the idea is:

  • on my views, when I open the template, I’ll render the data present on the model. Using serialization to extract the data, and send it to javascript’s table create class ;
  • create two javascript class: one the add a row the other to delete it,
  • create on JavaScript a class called “Save”. When I’m saving, I’ll send an Http Rest Post/Delete/Put method to Django;
  • Django sent me a new render after to make the modification (render all the template???)

I fear that I will have a new render each time I change my page. An alternative is to create a second view without rendering to answer the request provided by the HTML page.

Do you have any tips for more efficient handling of the tables?
Thank you, for your kind answers.

Kind regard,
Giorgio

Giorgio Bonacorsi

Depending upon just how “new” to this you are, you probably want to break this larger project into smaller, easier-to-digest, steps (or “stages”, or “milestones”).

I would start by ignoring the JavaScript parts of this completely. The easiest first step would be to create a traditional multi-page application. Render your page completely within Django. Handle your buttons with standard Django views.

This will give you a functional project that you know you can build from and enhance. You can then decide what you want to do to mix JavaScript into it. It’ll also help fix into your mind what happens in each location - a common source of confusion among those getting started.

The quickest path to frustration is to try and do too much at once - you end up with too many unknowns whenever you encounter a problem.