Brand new channel accepts merely Post demands

Brand new channel accepts merely Post demands

Brand new channel accepts merely Post demands

Do the exact same modification on the SQL declaration since in advance of, up coming change the history printing() function to display the thing ID in addition to property value complete :

Nothing of the things that could have been marked once the accomplished so that the property value completed for for every items try 0 , which means that untrue . So that users adjust this really worth and you can draw affairs because accomplished, you are going to include another path to the fresh new document.

Brand new would() glance at form requires a keen id disagreement-this is the ID of one’s product we should mark as completed. In the mode, your open a database union, then you definitely use an improvement SQL report to put the benefits of over column to at least one to your items become marked since the complete.

You employ the fresh new ? placeholder about execute() strategy and you may violation a tuple with which has the newest ID so you can safely input analysis into databases. Then you going your order and you can personal the relationship and reroute to the index webpage.

Shortly after incorporating a path to draw situations just like the done, you desire other path to undo this action and you can get back the new items so you can a low-finished standing.

It station is a lot like this new /do/ station, in addition to undo() see mode is precisely the same as this new do() function besides your set the worth of done to 0 instead of step one .

You now you would like a key to mark so you can-create situations because the finished otherwise uncompleted depending on the state from the thing, discover the new index.html theme file:

In this having cycle, you use a line-owing to CSS well worth on text-decor assets whether your item is actually designated as the done, you understand on value of items[‘done’] . Then chances are you make use of the Jinja sentence structure set-to state a couple variables, Website link and Option . In the event your item isn’t designated due to the fact finished the fresh new key usually have the worthy of Do therefore the Website link commonly direct into /do/ station, of course the item are noted as done, the button will have a value of Undo and can part to /undo/ . Shortly after, you use both of these parameters when you look at the an insight mode one to submits the proper request with regards to the state of your own product.

Add the adopting the route at the conclusion of brand new file:

You can now mark factors once the finished into index web page . Then you can add on the capacity to edit so you’re able to-perform issues.

3 – Editing In order to-Carry out Things

Within step, you are going to include a new webpage getting editing activities so you can transform the newest items in for every goods and you will designate items to different listing.

You are going to include yet another /edit/ path to new file, that may offer an alternate revise.html page in which a user can modify established facts. Additionally, you will posting new directory.html document to add a change switch to every product.

Within the fresh new check form, you use the new id dispute to help you bring the brand new ID of one’s to-perform goods we wish to modify, the latest ID of one’s record it falls under, the value of new complete column, the content of goods, in addition to number label using a SQL Signup . It can save you this info about todo varying. Then you get all to help you-carry out listing on database and you may rescue them regarding listings adjustable.

In the event the consult try a regular Get consult, the challenge in the event the request.strategy == ‘POST’ does not manage, so the app runs the past promote_template() mode, passageway both todo and you can listings so you’re able to a modify.html file.

When the not, a type was registered, the challenge request.method == ‘POST’ becomes true , then you pull the content together with record name the consumer registered. In the event that no stuff is actually submitted, you thumb the message Blogs is required! and you will reroute with the same edit webpage. Or even, you get the newest ID of your own record the user registered; this enables the user to move an inside-perform product from checklist to another. Up coming, make use of an upgrade SQL declaration to set the content of this new so you can-do product towards the the content an individual filed. You will do a comparable towards the listing ID. In the end, your to go the changes and you can romantic the relationship, and you can redirect the user into the directory web page.

Leave a Reply

Your email address will not be published. Required fields are marked *