- HD
- 720p
- 540p
- 360p
- 0.50x
- 0.75x
- 1.00x
- 1.25x
- 1.50x
- 1.75x
- 2.00x
We hope you enjoyed this lesson.
Cool lesson, huh? Share it with your friends
About this lesson
The underlying programming language of Django is Python. In this lesson, we'll explain how the Django Template Language allows you to use elements from Python within your Django projects.
Quick reference
Django Template Language
The Django Template Language allows us to do Python-like programming on a web page.
When to use
Use it any time you want to use Python-like programming on a web page.
Instructions
There are many tags that we can use with the Django Template Language, and we'll discuss them all in the coming videos.
For now, familiarize yourself with the Django documentation regarding the Django Template Language, located:
https://docs.djangoproject.com/en/3.0/ref/templates/language/
Hints & tips
- Django Template Language allows us to do Python-like programming on a web page.
- https://docs.djangoproject.com/en/3.0/ref/templates/language/
- 00:04 All right, in this video I want to start to talk about
- 00:04 the Django template language.
- 00:05 And we've already kind of looked at these a couple of videos here.
- 00:09 Now this is opening and closing tags.
- 00:11 And, I've showed you a couple of things that we can do.
- 00:15 We created these links using those.
- 00:18 We created this block content that allowed us to do our base.html stuff.
- 00:22 But I haven't really talked about what in the world these things are.
- 00:26 So when you have web frameworks like Django, like Ruby on Rails, like node,
- 00:30 most of the time those frameworks have an underlying programming language.
- 00:34 So for Django for instance, the underlying programming language is Python.
- 00:39 For Ruby on Rails, the underlying language is Ruby.
- 00:43 For node, the underlying language is JavaScript.
- 00:46 So, all of these things usually have template languages that allow you
- 00:51 to sort of use the programming language with the framework.
- 00:55 So for instance here, the Django template language sort of allows
- 01:00 us to use Python on our web-pages and that's really, really cool.
- 01:04 So we're seeing just little snippets of this here and
- 01:07 we're going to get into much more detail in the next few videos
- 01:10 of all the cool things we can do with the Django template language.
- 01:14 So, I want to show you just really quickly, head over to your web browser and
- 01:19 let's just type in Django template language.
- 01:22 And the first thing that pops up is going to be the the Django documentation.
- 01:26 And I haven't mentioned it before, but you can check out docs.djangoproject com/.
- 01:32 These are the Django documentation,
- 01:33 there's all kinds of cool stuff in here you can read.
- 01:36 But right now we just want to quickly kind of look at this page,
- 01:39 this Django template language and here's the URL for that.
- 01:42 You can see there's things we've already done, extends base and block things.
- 01:46 And here's a title thing, we'll talk about that in a bit.
- 01:49 What I want to really show you down here is variables.
- 01:51 One of the main things that programming language does is work with variables.
- 01:56 And think of variables as boxes, you can put stuff in them, right?
- 01:59 So to be able to use Python variables on a Django web page is pretty huge and
- 02:04 you can do that.
- 02:05 You'll notice these tags are just a little bit different.
- 02:08 Our original tags, we've been using in the last few videos have these curly brackets,
- 02:14 open and close, and these percentage signs open and close.
- 02:17 But when you use variables, you don't use those percentage signs,
- 02:21 you just do double curly brackets.
- 02:23 I'll show you this going forward.
- 02:25 You can see down here, we're doing a four loop, this is a Python thing.
- 02:29 There's all kinds of stuff, you can use filters, different tags,
- 02:33 comments if you wanted to.
- 02:35 All kinds of stuff and you can see this is a pretty big web-page,
- 02:39 there's a lot of stuff here.
- 02:41 And we're going to get into all of this in greater detail in the coming videos here.
- 02:47 But for this video, I just want to kind of point it out, show you this resource if
- 02:50 you're interested in really learning this stuff in much greater detail.
- 02:53 Like I said, I'm going to talk about a lot of this stuff in the next few videos,
- 02:57 the most important parts that you really want to focus on and learn.
- 03:01 But if you want to dive deeper, you can always come here and check this out.
- 03:04 So in the next video, we'll dive in here a little bit deeper.
- 03:07 We'll start to learn about block titles, why they're important and
- 03:10 some of the cool things you can do with it.
- 03:12 And that will be in the next video.
Lesson notes are only available for subscribers.