The brand new station welcomes merely Article desires

The brand new station welcomes merely Article desires

Carry out the exact same amendment towards the SQL declaration because the in advance of, next alter the last print() form to exhibit the item ID together with value of complete :

Not one of the items could have been noted once the finished therefore the property value completed for per product is actually 0 , and thus not the case . So that pages adjust this worthy of and mark affairs since the finished, you will include a separate path to brand new document.

The carry out() look at function takes an enthusiastic id conflict-this is basically the ID of items we would like to mark just like the accomplished. When you look at the means, your unlock a databases commitment, then you definitely fool around with an update SQL statement to set the benefits of the complete column to 1 to the product are noted given that completed.

You use the fresh ? placeholder on the carry out() method and ticket a beneficial tuple with the new ID so you’re able to securely submit studies into databases. You then to go the order and you will romantic the relationship and you can redirect on index web page.

Once incorporating a path to mark activities just like the finished, you prefer other route to undo this action and you will come back the fresh new items site web de rencontre pour polyamoureux in order to a non-done standing.

So it station is similar to the fresh new /do/ route, therefore the undo() check function is precisely just like the brand new would() mode besides you put the worth of completed to 0 unlike 1 .

At this point you you want a button so you can mark so you’re able to-carry out facts as the complete or uncompleted according to state from the item, discover brand new list.html template document:

Within this to own circle, you employ a column-because of CSS well worth towards the text message-decor assets if for example the goods is actually noted since finished, you know regarding the property value product[‘done’] . Then you certainly make use of the Jinja syntax set to state several details, Hyperlink and you will Switch . In case the goods is not designated as accomplished the key often have the worth Do in addition to Hyperlink often direct to your /do/ station, just in case the item is actually designated once the done, the newest key will receive a value of Undo and can point so you can /undo/ . After, you employ these two parameters when you look at the an insight function that submits the proper demand depending on the state of your product.

Range from the pursuing the route at the conclusion of the document:

You can now mark circumstances because the done into list page . After that you can truly add the capability to modify to-manage activities.

Step three – Editing To-Perform Issues

Contained in this step, you’ll incorporate a new web page having modifying activities you can alter the newest belongings in for every product and you can designate items to other listing.

You’ll add yet another /edit/ path to the document, that’ll provide an alternative revise.html code where a person can modify current affairs. You will also posting brand new directory.html document to incorporate an edit option to each and every item.

Inside the brand new see means, make use of brand new id conflict so you can fetch new ID of your to-carry out product we should modify, the newest ID of the list they is part of, the worth of brand new complete column, the content of your own item, plus the listing label using a SQL Signup . It will save you this information throughout the todo variable. Then you certainly score the in order to-manage lists throughout the databases and you will cut her or him in the lists variable.

If your demand is actually a frequent Get demand, the issue in the event that request.method == ‘POST’ does not work with, therefore the software runs the very last bring_template() function, passing each other todo and you can listings in order to a change.html file.

In the event the however, a type are recorded, the condition request.strategy == ‘POST’ gets correct , then you definitely extract the content plus the listing title an individual recorded. In the event that zero stuff is filed, your flash the message Posts becomes necessary! and you will redirect on exact same change webpage. Or even, your bring the fresh ID of your number the consumer recorded; this enables the consumer to maneuver a to-perform items from number to some other. Following, you employ an upgrade SQL statement to set the content out-of the new so you’re able to-would goods into the the newest posts the consumer filed. You will do an equivalent with the number ID. Ultimately, your to visit the alterations and you can romantic the relationship, and redirect the consumer for the index webpage.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *