The new station accepts simply Article demands

Perform some exact same amendment into the SQL statement as prior to, next alter the past printing() mode to display the item ID together with property value over :

Not one of the items has been marked while the accomplished and so the value of done for for each and every goods is actually 0 , which means that incorrect . So that users adjust which value and you will draw activities just like the completed, might put a special approach to the brand new document.

The fresh new manage() take a look at mode takes a keen id disagreement-this is actually the ID of your item we need to mark once the completed. In form, you discover a databases partnership, then you definitely use an improve SQL declaration to set the benefits of complete column to at least one toward items to be designated once the complete.

You use the newest ? placeholder in the execute() strategy and you may admission a beneficial tuple who has the fresh ID so you’re able to properly submit study into the databases. Then you certainly going the order and you may romantic the partnership and reroute for the list page.

Once including an approach to mark facts since the finished, you desire several other path to undo this task and get back the fresh items so you’re able to a low-finished position.

This station is like new /do/ route, plus the undo() consider function is exactly just like the fresh manage() mode besides you set the value of completed to 0 as opposed to step one .

You now need a key to help you draw so you can-would points while the done or uncompleted with respect to the county regarding the item, open the fresh directory.html theme document:

Within this getting circle, you utilize a line-compliment of CSS worth into the text message-decoration property in case your goods is actually marked once the done, which you understand regarding the worth of items[‘done’] . Then you utilize the Jinja sentence structure set to state two details, Website link and you will Option . If the product isn’t marked since the completed new option will feel the worthy of Carry out therefore the Url have a tendency to head toward /do/ route, and in case the item try marked since the accomplished, the key can get a worth of Undo and certainly will point to help you /undo/ . Just after, you use both these parameters inside an input form one submits just the right consult with regards to the condition of your items.

Range from the after the route after the fresh document:

Anyone can draw circumstances because the done on list web page . Then you can add the capacity to revise to-do facts.

3 – Modifying To help you-Perform Points

In this action, you are going to put yet another web page for modifying products which means you can modify the new items in for every product and you may assign points to other lists.

You are going to create a different /edit/ path to the document, which will give a different sort of change.html page in which a user can alter present facts. You will also modify the newest list.html document to add a revise button to every product.

In this the new glance at means, you employ brand new id conflict in order to get new ID of to-perform items we want to modify, the newest ID of your list they falls under, the worth of the latest over line, the content of your goods, additionally the record term having fun with a beneficial SQL Join . It can save you this info in the todo variable. You then get all to help you-manage listings on databases and rescue him or her about listing variable.

If for example the request try a normal Rating request, the matter if the demand.method == ‘POST’ will not run, therefore the app carries out the very last give_template() setting, passage each other todo and you will listings to a modify.html file.

In the event the not, a type are registered, the matter consult.strategy == ‘POST’ gets genuine , then you definitely extract the content and also gratis sito incontri travestiti the record label an individual submitted. If the zero stuff was submitted, your flash the message Blogs needs! and you can reroute toward exact same modify page. If not, you bring the fresh ID of record the consumer filed; this allows the consumer to move a towards-create item from checklist to some other. Upcoming, you use an improvement SQL declaration setting the content away from brand new to-carry out product into the latest stuff the consumer submitted. You are doing an equivalent with the list ID. Ultimately, you to go the changes and personal the connection, and you will reroute the consumer to your list page.

Related Article