Perform the exact same modification with the SQL report due to the fact prior to, following replace the last print() means showing the thing ID in addition to worth of complete :
Nothing of the things that might have been marked given that complete and so the property value done for for each item is actually 0 , meaning that untrue . So that profiles to switch that it value and you will draw activities as complete, you are going to include a different sort of route to the new document.
New manage() check means takes a keen id dispute-here is the ID of your own items we want to draw just like the accomplished. In mode, your discover a databases commitment, then chances are you explore an improve SQL statement setting the significance of your own complete line to 1 into the goods are designated because complete.
You utilize the brand new ? placeholder from the execute() means and you can admission an excellent tuple with the new ID so you can safely insert analysis with the databases. Then you certainly to go your order and you can romantic the connection and you will redirect with the directory zusÃ¤tzliche Ressourcen page.
Once including a path to mark points because the finished, you desire various other path to undo this task and you can get back the newest product so you’re able to a low-done reputation.
It station is similar to the /do/ channel, therefore the undo() glance at function is strictly similar to the perform() form other than you set the value of done to 0 as opposed to 1 .
You now you need a button so you’re able to mark so you’re able to-do situations given that finished otherwise uncompleted according to county out of the item, unlock brand new list.html template file:
Within having cycle, you employ a line-because of CSS well worth towards the text-decoration assets if for example the goods is actually designated given that complete, which you learn from the property value product[‘done’] . Then you definitely use the Jinja sentence structure set to declare one or two variables, Url and Switch . If your goods isn’t marked due to the fact completed the new option often feel the worthy of Create while the Url often head with the /do/ station, just in case the object was designated due to the fact done, the fresh key are certain to get a property value Undo and certainly will point to /undo/ . Immediately following, you utilize both these details from inside the an insight function you to submits just the right consult depending on the state of your own item.
Range from the pursuing the channel at the conclusion of the file:
You can now draw affairs as completed to the index webpage . After that you can add on the capacity to revise to-carry out circumstances.
3 – Modifying So you can-Create Products
Within this action, you are going to include a separate web page to have modifying items so you can alter the brand new contents of each item and you can designate things to some other directories.
Might create another type of /edit/ approach to the latest file, that promote a unique edit.code where a user can alter current items. You will also inform the directory.html file to include a change option to each and every items.
Inside the fresh new take a look at form, you use this new id argument in order to get the new ID of one’s to-would items we would like to revise, the brand new ID of one’s list it is part of, the worth of the done column, the message of the item, therefore the checklist term having fun with good SQL Signup . It will save you these records in the todo varying. Then chances are you get all of the to help you-carry out lists regarding database and you can rescue him or her about directories variable.
In case the demand are a normal Get request, the issue when the consult.method == ‘POST’ does not manage, so that the application executes the very last render_template() mode, passageway one another todo and you will listings so you can a change.html file.
In the event the yet not, a form was filed, the issue consult.means == ‘POST’ gets correct , in which case you pull the message therefore the record label an individual filed. In the event that no stuff is filed, you thumb the message Posts is necessary! and you will reroute into same edit page. Otherwise, your get this new ID of your own listing an individual filed; this allows the consumer to move a toward-would item from just one list to some other. After that, you use an upgrade SQL statement to set the content off this new so you can-carry out item towards the newest posts the consumer filed. You do a similar for the number ID. In the long run, you going the alterations and you may romantic the relationship, and you can reroute the user toward list page.