Advanced Jinja

Full Transcript

welcome doctor phlox tutorial in this video we're going to see how to use template engine features to display data in a better way

in this case we're going to take from our previous example oh nine simple database up

in this case if you check it closely you will see that we are fetching all the authors from our initial data %HESITATION database in this case you have four authors but yet when when you dis plan we see is just three offers

and that's because there authors took HTML date template use in our %HESITATION nine example is hard coding system free offers we have four but it's his heart coning three authors

so what we have to do is use the template engine features to it right through that off first list and display them all together

so to do that but we're going to do is just

I commands these lines and can go or pens example

and what if we inspect closely our example we'll see that in this case the code looks extrapolated same where schist fetching all the offer from our database and then we're rendering apparently of scores of families the friends and he sees what we're showing you where showing you that I'm application can change completely just by changing the template I am Brenner's

so if I show you now that our first template and shame template you will see that instead of hard coding

and their authors is played like in this case what we are doing is we are either dating through there author's least and we are creating annual list item which with each one of those offers

so if I reload our website now

you will see that we have now for of course he's dead of three

that's Rick quickly seed the next example to so in this case that example number ten let me

I'm commands and

come on these example if we checked it example number eleven were conceived out we have this same

source code again but we are schist rendering I'm you template in this case its authors with conditional on what bush is doing here is we're using a can

channel two either %HESITATION either a bowl notation to our it to some of course or not so good and results

as you will see

is exactly these and you can expect seed out because we are adding a bowl annotation if compare author's ID's less or equal dances so that's why the first two authors have them

bold com markup

but we want to show you here is that but she's chan changing the template you can create major changes in your application

the business logic offer examples remain the same but we just clicked their way we show or display our