Carry out the same amendment for the SQL statement since in advance of, then replace the last print() form to show the object ID together with property value over :

Nothing of the things that has been designated as finished so that the property value completed for for each goods is 0 , for example false . So that pages to evolve which worthy of and you may mark activities given that completed, you will create an alternative path to the newest file.

The do() have a look at function takes an enthusiastic id dispute-this is basically the ID of your item we wish to mark because accomplished. Within the function, your discover a databases commitment, then you certainly fool around with an upgrade SQL statement to create the value of your own complete column to 1 to your goods become noted while the accomplished.

Make use of the latest ? placeholder throughout the perform() strategy and admission an excellent tuple with which has the new ID to help you safely enter research into the databases. You then to visit the transaction and you will intimate the relationship and redirect on directory webpage.

Immediately following adding a route to draw products while the finished, you desire other approach to undo this action and you can come back brand new items to help you a non-done condition.

That it channel is a lot like new /do/ station, and the undo() look at means is precisely the same as the latest create() mode aside from you place the value of done to 0 rather than 1 .

You now you need an option so you can draw in order to-perform items because completed otherwise uncompleted according to the state away from the thing, open the new index.html template document:

Within to possess loop, you use a line-as a consequence of CSS well worth into the text message-decoration gratis incontri genitori single property whether your product is designated as accomplished, which you know in the property value items['done'] . Then you definitely use the Jinja syntax set-to claim one or two parameters, Hyperlink and you will Key . If the goods isn’t designated since the accomplished the brand new button tend to have the worthy of Would additionally the Url have a tendency to lead towards the /do/ channel, and when the object is marked once the finished, brand new key are certain to get a property value Undo and will point to /undo/ . Shortly after, make use of these two details for the an insight form you to definitely submits best demand according to state of items.

Are the following station after brand new document:

Anybody can mark items given that done with the list web page . Then you can add the capacity to revise so you can-manage things.

3 – Editing So you can-Would Factors

Within this action, you’ll include a new webpage to have modifying facts which means you can modify the fresh new contents of for every item and you will designate points to different directories.

You’ll add yet another /edit/ approach to the fresh document, that’ll render yet another modify.html code in which a user can transform current factors. You will additionally revision the latest index.html document to provide an edit button to every items.

Inside brand new take a look at form, you use the latest id conflict so you can fetch the new ID of your own to-create product you want to edit, brand new ID of list it is part of, the worth of this new complete line, the message of your product, while the number label playing with a beneficial SQL Subscribe . It will save you these details on the todo adjustable. Then you certainly score all so you can-create listing regarding the databases and help save him or her on the lists adjustable.

If your consult is actually a routine Get request, the matter when the request.method == ‘POST’ cannot work with, and so the app runs the last bring_template() means, passing each other todo and you may directories in order to a revise.html document.

In the event the but not, a form is actually registered, the condition demand.means == ‘POST’ becomes correct , in which case you pull the message plus the checklist term the consumer filed. If the no stuff are submitted, your flash the content Articles is needed! and you will redirect to your same modify web page. Otherwise, you fetch the fresh ID of your own number an individual recorded; this allows the user to go an inside-perform goods in one checklist to some other. Up coming, you utilize an improve SQL report setting the content from the fresh so you’re able to-manage item to your the new blogs the user recorded. You do a comparable with the list ID. Eventually, you going the alterations and you can close the connection, and you will redirect an individual into directory webpage.

Leave a Comment

STYLE SWITCHER

Layout Style

Header Style

Accent Color