Skip to content

Commit cecc00f

Browse files
committed
Merge branch 'master' of github.com:asendecka/djangogirls-tutorial
2 parents 3677dae + 8fb0662 commit cecc00f

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

css/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ Now we need to tell Django how it can find it. Open up a `mysite/mysite/settings
4444
os.path.join(BASE_DIR, "static"),
4545
)
4646

47-
This way Django will now where your static files are.
47+
This way Django will know where your static files are.
4848

4949
That's it! Time to see if it works :)
5050

5151
## Your first CSS file!
5252

53-
First things first: let's now create a CSS file. Create a new folder called `css` inside your `static` folder. Then create a new file called `blog.css` inside this `css` directory. Ready?
53+
First things first: let's create a CSS file now. Create a new folder called `css` inside your `static` folder. Then create a new file called `blog.css` inside this `css` directory. Ready?
5454

5555
Time to write some CSS! Open up your `blog.css` file in code editor.
5656

extend_your_application/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,30 @@ It worked! But what happens when you click a link in blog post title?
120120
Oh no! Error once again. But we already know how to deal with it, right? We need to add a template!
121121

122122
We will create a file in `blog/template/blog` called `post_detail.html`.
123+
124+
It will look like this:
125+
{% extends 'mysite/base.html' %}
126+
{% load future %}
127+
128+
{% block content %}
129+
<div class="date">
130+
{% if post.published_date %}
131+
{{ post.published_date }}
132+
{% endif %}
133+
</div>
134+
<h1>{{ post.title }}</h1>
135+
<p>{{ post.text }}</p>
136+
{% endblock %}
137+
138+
Once again we are extending `base.html`. In `content` block we want to display post's published_date (if exists), title and text. But we should discuss some important things, right?
139+
140+
`{% if ... %} ... {% endif %}` is a templatetag we can use when we want to check something. In this scenario we want to check if post's `published_date` is not empty.
141+
142+
Ok we can refresh our page and see if `Page not found` is gone now.
143+
144+
![Post detail page](images/post_detail.png)
145+
146+
Yay! It works!
147+
148+
You should be proud of yourself!
149+
116 KB
Loading

0 commit comments

Comments
 (0)