Brand new route accepts merely Post desires

Brand new route accepts merely Post desires

Carry out the same modification into the SQL report just like the ahead of, after that alter the history print() mode to show the item ID additionally the worth of over :

Not one of the things that has been designated given that finished so that the worth of accomplished for for every item are 0 , which means not true . To let pages to alter so it worth and you can mark situations because complete, you’ll incorporate a unique route to the file.

The latest create() have a look at setting takes an id conflict-this is the ID of your goods we should mark since finished. Inside function, you discover a database connection, then chances are you play with an improve SQL statement setting the significance of your over column to just one on the product is noted due to the fact done.

You use new ? placeholder on the perform() method and you can admission a tuple that contains the new ID to securely input data on databases. Then you to visit your order and you may romantic the relationship and reroute on list webpage.

Immediately after including a route to draw products as the completed, you want another approach to undo this step and get back the latest product to a low-done position.

It route is like the fresh new /do/ channel, and the undo() take a look at mode is exactly similar to the perform() function other than you lay the value of completed to 0 unlike step one .

At this point you you need a key to help you mark so you can-manage situations once the finished otherwise uncompleted with respect to the county off the object, unlock the brand new index.html template file:

Within this to have cycle, you use a column-owing to CSS well worth on text-decoration assets in the event the product try designated as the finished, you understand on the worth of goods[‘done’] . Then you make use of the Jinja syntax set to declare a couple of parameters, Website link and Button . When your product isn’t designated since finished the new option often have the worth Manage therefore the Website link usually lead for the /do/ station, assuming the thing are marked once the finished, the new switch can get a value of Undo and will section so you’re able to /undo/ . Once, you utilize both these parameters when you look at the an input means one to submits best demand according to county of your own goods.

Are the adopting the station at the end of the brand new document:

Anybody can mark points since the completed for the directory web page . Next you will add the capacity to change so you can-would products.

Step 3 – Modifying So you can-Create Points

In this step, you are going to create an alternate web page for editing products you can transform brand new belongings in per items and you can assign points to more lists.

You will create an alternative /edit/ path to the fresh file, that promote yet another modify.html code in which a person can modify present products. Additionally posting the latest directory.html document to incorporate a revise key every single product.

Inside the fresh new look at function, you use the new id dispute in order to get the ID of your to-perform items we should change, the fresh ID of one’s listing it falls under, the value of brand new done column, the content of your product, and also the checklist identity having fun with a SQL Subscribe . You save this info from the todo adjustable. Then you definitely score all of the in order to-would directories regarding database and you will save him or her from the lists changeable.

In the event the consult is a routine Get request, the challenge if consult.means == ‘POST’ cannot manage, so that the application executes the very last bring_template() means, passage one another todo and you may listings in order to an edit.html file.

If the however, a type is actually filed, the issue consult.approach == ‘POST’ becomes correct , then you pull the message together with list name the consumer submitted. In the event the zero posts are filed, your flash the message Articles will become necessary! and you can reroute towards same edit web page. Otherwise, you fetch the fresh new ID of your own record the user recorded; this permits the consumer to move a towards-manage items from one number to some other. Upcoming, you employ an improvement SQL statement to create the content out-of new so you’re able to-would items for the the articles an individual submitted. You will do a similar toward record ID. Finally, your to visit the alterations and you can romantic the connection, and redirect the consumer to your directory web page.

Leave a Reply

Your email address will not be published.