From the course: Learning Django

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Doing more with Django templates

Doing more with Django templates

From the course: Learning Django

Start my 1-month free trial

Doing more with Django templates

- [Instructor] Now, let's use Jango templates a bit more to build out our pet detail page. First, I'll open my editor, unfold the wisdom pets folder, then adoptions, templates, and I'll double click on the pet detail file. First I'll clear out what we had before. For this template, we'll also start with an outer div. Recall that the view for this template passes in a single pet instance as the variable pet. So we won't loop over pets. Recall that this template has a single pet instance passed to it from its view. So we'll just use a pet variable directly. First, I'd like to show the pet name similar to how we did on the home page. So, I'll make an H three tag, and I'll use the pet dot name variable and I'll pass this into the cap first filter. For the rest of this template, we want to show all the rest of the pet details, so I'll go ahead and start with a P tag and I'll show the pet species, much like before.…

Contents