Skip to content

Commit c635685

Browse files
committed
Add tooltip to warning icon and fill out other major intro section
1 parent e620ab9 commit c635685

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

en/extend_your_application/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% set warning_icon = '<span class="glyphicon glyphicon-exclamation-sign" style="color: red;" aria-hidden="true" data-toggle="tooltip" title="An error is expected when you run this code!" ></span>' %}
2+
13
# Extend your application
24

35
We've already completed all the different steps necessary for the creation of our website: we know how to write a model, url, view and template. We also know how to make our website pretty.
@@ -30,7 +32,7 @@ We will start with adding a link inside `blog/templates/blog/post_list.html` fil
3032

3133
{% raw %}We want to have a link from a post's title in the post list to the post's detail page. Let's change `<h1><a href="">{{ post.title }}</a></h1>` so that it links to the post's detail page:{% endraw %}
3234

33-
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
35+
{% filename %}{{ warning_icon }} blog/templates/blog/post_list.html{% endfilename %}
3436
```html
3537
<h1><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h1>
3638
```
@@ -53,7 +55,7 @@ We want our first post's detail to be displayed at this **URL**: http://127.0.0.
5355

5456
Let's make a URL in the `blog/urls.py` file to point Django to a *view* named `post_detail`, that will show an entire blog post. Add the line `url(r'^post/(?P<pk>\d+)/$', views.post_detail, name='post_detail'),` to the `blog/urls.py` file. The file should look like this:
5557

56-
{% filename %}blog/urls.py{% endfilename %}
58+
{% filename %}{{ warning_icon }} blog/urls.py{% endfilename %}
5759
```python
5860
from django.conf.urls import url
5961
from . import views
@@ -85,7 +87,7 @@ This time our *view* is given an extra parameter, `pk`. Our *view* needs to catc
8587

8688
Now, we want to get one and only one blog post. To do this, we can use querysets, like this:
8789

88-
{% filename %}blog/views.py{% endfilename %}
90+
{% filename %}{{ warning_icon }} blog/views.py{% endfilename %}
8991
```python
9092
Post.objects.get(pk=pk)
9193
```

en/python_introduction/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% set warning_icon = '<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" style="color: red;"></span>' %}
1+
{% set warning_icon = '<span class="glyphicon glyphicon-exclamation-sign" style="color: red;" aria-hidden="true" data-toggle="tooltip" title="An error is expected when you run this command!" ></span>' %}
22

33
# Introduction to Python
44

@@ -144,7 +144,7 @@ Traceback (most recent call last):
144144
TypeError: object of type 'int' has no len()
145145
```
146146

147-
We got our first error! The {{ warning_icon }} icon is our way of giving you a heads up that errors are expected in the command you're about to run. We all make mistakes and they're an important part of learning!
147+
We got our first error! The {{ warning_icon }} icon is our way of giving you a heads up that the code you are about to run won't work as expected. Making mistakes (even intentional ones) are an important part of learning!
148148

149149
It says that objects of type "int" (integers, whole numbers) have no length. So what can we do now? Maybe we can write our number as a string? Strings have a length, right?
150150

@@ -502,7 +502,7 @@ You can give Python as many numbers to compare as you want, and it will give you
502502

503503
Have you heard of the expression "comparing apples to oranges"? Let's try the Python equivalent:
504504

505-
{% filename %}{{ warning_icon }} ccommand-line{% endfilename %}
505+
{% filename %}{{ warning_icon }} command-line{% endfilename %}
506506
```python
507507
>>> 1 > 'django'
508508
Traceback (most recent call last):
@@ -853,7 +853,7 @@ hi()
853853

854854
Remember: The `print` function is indented four spaces within the `if` statement. This is because the function runs when the condition is met. Let's see how it works now:
855855

856-
{% filename %}command-line{% endfilename %}
856+
{% filename %}{{ warning_icon }} command-line{% endfilename %}
857857
```
858858
$ python3 python_intro.py
859859
Traceback (most recent call last):

0 commit comments

Comments
 (0)