Django 4 Week Challenge: If Statements
I’ve started using if statements into Django, and it’s actually not that hard to understand. It’s pretty easy to pull Python dictionaries and present them as a list in an HTML page.
So in my view I have a context with just basic information that I want to pull into my about template page.
Now for me to be able to bring that information into my page I do the following.
Here you can see I can list those variables by themselves using which simply shows the one item, but what if I had more than one item in say a list. That’s when the for statement comes in. As you can see I have a for and if statements to pull my_list and put it into an HTML list.
It’s all making sense for the time being and I’m excited to see what else I can do with Django, as I know this stuff is still pretty basic.