samedi 23 novembre 2019

Django Design question: How to break down the code properly

I would like to build an app which has some UI but a lot of backend activities. Basically, I would like to loop over list of files in a directory. for each such file, I would need to get a user feedback what is the type of the file, and then based on the file type, read all it's records and do some work on each. So the code will basically do:
Loop over all the files in a directory:
for each file --> Show the user the file name and then the user can select the right file type
Loop over all records in this file
Do Something

My question is where should the loop over the files should be? In the view or in the html?
If it is in the view, the HTML rendering to ask the user to select file type will be moving the control to the client (html) and then (after after user selection), It will return as a POST reply (outside the loop), right? So should the loop over the files be in the html itself?

What should be the right breakup between the HTML and the View?

Aucun commentaire:

Enregistrer un commentaire