The newest channel accepts merely Article needs
The newest channel accepts merely Article needs
The newest channel accepts merely Article needs

Perform the same modification into SQL statement as just before, after that change the past print() means showing the item ID therefore the property value over :

Nothing of the items has been designated because the completed therefore, the worth of accomplished for for every single product try 0 , which means that not the case . To let users to switch that it well worth and you will draw activities given that complete, you will create yet another approach to the brand pansexuelle Dating-Seite Bewertungen wollen new file.

The new manage() see function requires an id argument-this is the ID of your own items we want to mark because complete. For the function, your discover a database connection, then you have fun with an update SQL declaration to put the significance of over column to just one to your product getting designated as accomplished.

Make use of brand new ? placeholder regarding the do() approach and you may citation a beneficial tuple containing brand new ID to help you securely insert data to your database. You then commit the order and you may personal the relationship and you may redirect on list webpage.

Shortly after including an approach to draw things since the done, you need several other path to undo this and you will go back new product so you can a low-complete status.

So it channel is similar to the brand new /do/ channel, therefore the undo() look at means is strictly exactly like the fresh new perform() form besides your set the value of done to 0 instead of step one .

You now you would like a switch to help you draw to-create circumstances just like the accomplished or uncompleted according to the state off the object, open the newest index.html layout document:

In this for loop, you employ a line-thanks to CSS worthy of towards the text-decorations property in case the goods try noted while the finished, that you understand on the value of product['done'] . Then you make use of the Jinja syntax set-to state a couple parameters, Website link and you may Button . In the event the item isn’t marked while the complete the option usually feel the worth Would in addition to Hyperlink tend to direct to the /do/ station, while the object was designated as complete, the newest option gets a property value Undo and will point in order to /undo/ . Once, you utilize these two parameters within the an input setting that submits best request according to the county of product.

Range from the pursuing the route after the brand new document:

Anybody can mark factors because done into list webpage . Then you can add on the capacity to change to help you-carry out products.

Step three - Modifying To-Would Circumstances

Within action, might incorporate another webpage getting modifying issues and that means you can transform the newest contents of for every single item and you will designate factors to other lists.

You will put an alternative /edit/ route to the brand new file, that will give a different sort of change.html code where a person can alter present factors. You will up-date the brand new index.html document to provide a revise option to every items.

Within new view function, you employ the latest id conflict to help you bring the ID of the to-carry out goods we want to revise, this new ID of one's number they belongs to, the worth of new complete column, the content of the items, in addition to checklist identity using good SQL Signup . It will save you these records regarding the todo adjustable. Then you certainly score all in order to-do directories regarding databases and cut him or her from the listings changeable.

In case your consult are a regular Get demand, the problem in the event the request.means == 'POST' doesn't run, and so the software carries out the very last offer_template() setting, passageway both todo and you can listing to a revise.html document.

In the event that however, a form is registered, the challenge demand.strategy == 'POST' gets genuine , then you definitely pull the message additionally the record label the consumer filed. If no articles is registered, your flash the message Content will become necessary! and you will redirect towards the exact same revise web page. If you don't, your fetch the newest ID of one's list the consumer filed; this enables an individual to move a toward-do items from listing to another. Following, you utilize an improvement SQL statement setting the message away from the newest to-do goods on the brand new blogs the user filed. You will do a comparable to your number ID. In the end, your going the changes and you can personal the relationship, and you may redirect the user toward list page.

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.