From 15e609e63c0b163799acf03d2d2a25b260a2aca3 Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 14:10:47 +0530 Subject: [PATCH 01/37] Updated boostrap link URLs --- en/css/README.md | 9 +++------ en/django_forms/README.md | 5 ++--- en/template_extending/README.md | 3 +-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/en/css/README.md b/en/css/README.md index d7736822530..aa60b6a7b72 100644 --- a/en/css/README.md +++ b/en/css/README.md @@ -20,8 +20,7 @@ To install Bootstrap, open up your `.html` file in the code editor and add this {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html - - + ``` This doesn't add any files to your project. It just points to files that exist on the Internet. So go ahead, open your website and refresh the page. Here it is! @@ -68,7 +67,7 @@ djangogirls Time to write some CSS! Open up the `blog/static/css/blog.css` file in your code editor. -We won't be going too deep into customizing and learning about CSS here. There is a recommendation for a free CSS course at the end of this page if you would like to learn more. +We won't be going too deep into customizing and learning about CSS here. There is a recommendation for a free CSS course at the end of this page if you would like to learn more. But let's do at least a little. Maybe we could change the color of our headers? To understand colors, computers use special codes. These codes start with `#` followed by 6 letters (A–F) and numbers (0–9). For example, the code for blue is `#0000FF`. You can find the color codes for many colors here: http://www.colorpicker.com/. You may also use [predefined colors](http://www.w3schools.com/colors/colors_names.asp), such as `red` and `green`. @@ -119,8 +118,7 @@ Your file should now look like this: Django Girls blog - - + @@ -300,4 +298,3 @@ Don't be afraid to tinker with this CSS a little bit and try to change some thin We really recommend taking the free online courses "Basic HTML & HTML5" and "Basic CSS" on [freeCodeCamp](https://learn.freecodecamp.org/). They can help you learn all about making your websites prettier with HTML and CSS. Ready for the next chapter?! :) - diff --git a/en/django_forms/README.md b/en/django_forms/README.md index 8c50269cd7b..a20d726797f 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -61,8 +61,7 @@ After adding the line, your HTML file should now look like this: Django Girls blog - - + @@ -98,7 +97,7 @@ And the final code will look like this: {% filename %}blog/urls.py{% endfilename %} ```python -from django.urls import path +from django.urls import path from . import views urlpatterns = [ diff --git a/en/template_extending/README.md b/en/template_extending/README.md index 1618809d415..f659be31c2b 100644 --- a/en/template_extending/README.md +++ b/en/template_extending/README.md @@ -26,8 +26,7 @@ Then open it up in the code editor and copy everything from `post_list.html` to Django Girls blog - - + From bb77fce0b4f9dd76ed689e4d948892cb00cecb3d Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 14:16:18 +0530 Subject: [PATCH 02/37] Updated DOCTYPE as per HTM5 standards --- en/css/README.md | 1 + en/django_forms/README.md | 1 + en/html/README.md | 6 +++++- en/template_extending/README.md | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/en/css/README.md b/en/css/README.md index aa60b6a7b72..76f92ccfd90 100644 --- a/en/css/README.md +++ b/en/css/README.md @@ -115,6 +115,7 @@ Your file should now look like this: {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html {% load static %} + Django Girls blog diff --git a/en/django_forms/README.md b/en/django_forms/README.md index a20d726797f..fcbbecaedf3 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -58,6 +58,7 @@ After adding the line, your HTML file should now look like this: {% filename %}blog/templates/blog/base.html{% endfilename %} ```html {% load static %} + Django Girls blog diff --git a/en/html/README.md b/en/html/README.md index dfa7e62095e..1281e9a771e 100644 --- a/en/html/README.md +++ b/en/html/README.md @@ -40,6 +40,7 @@ Open the new file in the code editor, and add the following: {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html +

Hi there!

@@ -54,7 +55,8 @@ So how does your website look now? Visit it to find out: http://127.0.0.1:8000/ It worked! Nice work there :) -- The most basic tag, ``, is always the beginning of any web page and `` is always the end. As you can see, the whole content of the website goes between the beginning tag `` and closing tag `` +- The line `` is not a HTML tag. It only declares the document type. Here, it informs the browser that document type is [HTML5](https://html.spec.whatwg.org/#the-doctype). This is always the beginning of any HTML5 file. +- The most basic tag, ``, is always the beginning of html content and `` is always the end. As you can see, the whole content of the website goes between the beginning tag `` and closing tag `` - `

` is a tag for paragraph elements; `

` closes each paragraph ## Head and body @@ -71,6 +73,7 @@ For example, you can put a web page title element inside the ``, like this {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html + Ola's blog @@ -113,6 +116,7 @@ Here's an example of a full template, copy and paste it into `blog/templates/blo {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html + Django Girls blog diff --git a/en/template_extending/README.md b/en/template_extending/README.md index f659be31c2b..2e9a672464b 100644 --- a/en/template_extending/README.md +++ b/en/template_extending/README.md @@ -23,6 +23,7 @@ Then open it up in the code editor and copy everything from `post_list.html` to {% filename %}blog/templates/blog/base.html{% endfilename %} ```html {% load static %} + Django Girls blog From 0c9ea5f7159f710dcc65ec188769b5e230c08f0e Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 14:33:28 +0530 Subject: [PATCH 03/37] Updated CSS for bootstrap4 --- en/css/README.md | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/en/css/README.md b/en/css/README.md index 76f92ccfd90..74a58905a87 100644 --- a/en/css/README.md +++ b/en/css/README.md @@ -77,7 +77,7 @@ In your `blog/static/css/blog.css` file you should add the following code: {% filename %}blog/static/css/blog.css{% endfilename %} ```css h1 a, h2 a { - color: #FF8833; + color: #C25100; } ``` @@ -208,36 +208,43 @@ We will now add declaration blocks to different selectors. Selectors starting wi .page-header { background-color: #C25100; margin-top: 0; + margin-bottom: 40px; padding: 20px 20px 20px 40px; } -.page-header h1, .page-header h1 a, .page-header h1 a:visited, .page-header h1 a:active { +.page-header h1, +.page-header h1 a, +.page-header h1 a:visited, +.page-header h1 a:active { color: #ffffff; font-size: 36pt; text-decoration: none; } -.content { - margin-left: 40px; -} - -h1, h2, h3, h4 { +h1, +h2, +h3, +h4 { font-family: 'Lobster', cursive; } .date { color: #828282; + float: right; } .save { float: right; } -.post-form textarea, .post-form input { +.post-form textarea, +.post-form input { width: 100%; } -.top-menu, .top-menu:hover, .top-menu:visited { +.top-menu, +.top-menu:hover, +.top-menu:visited { color: #ffffff; float: right; font-size: 26pt; @@ -248,9 +255,28 @@ h1, h2, h3, h4 { margin-bottom: 70px; } -.post h2 a, .post h2 a:visited { +.post h2 a, +.post h2 a:visited { color: #000000; } + +.post .actions { + float: right; + margin: auto 10px; +} + +.btn-default { + color: rgb(255, 148, 0); + background: none; + border-color: rgb(255, 148, 0); +} + +.btn-default:hover, +.btn-default:visited { + color: rgb(255, 255, 255); + background-color: rgb(255, 148, 0); + border-color: rgb(204, 179, 144); +} ``` Then surround the HTML code which displays the posts with declarations of classes. Replace this: From 1ef88173960479deeeb69fbbdfd6fe0d7a55fe3a Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 15:32:47 +0530 Subject: [PATCH 04/37] Added container to page-header --- en/css/README.md | 6 ++++-- en/django_forms/README.md | 10 ++++++---- en/template_extending/README.md | 9 +++++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/en/css/README.md b/en/css/README.md index 74a58905a87..2a62d2e5d8f 100644 --- a/en/css/README.md +++ b/en/css/README.md @@ -181,12 +181,14 @@ Great! As mentioned above, CSS has a concept of classes. These allow you to name a part of the HTML code and apply styles only to this part, without affecting other parts. This can be super helpful! Maybe you have two divs that are doing something different (like your header and your post). A class can help you make them look different. -Go ahead and name some parts of the HTML code. Add a class called `page-header` to your `div` that contains your header, like this: +Go ahead and name some parts of the HTML code. Replace the `div` that contains your header with the following: {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html ``` diff --git a/en/django_forms/README.md b/en/django_forms/README.md index fcbbecaedf3..45ef7b247a9 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -44,7 +44,7 @@ So once again we will create a link to the page, a URL, a view and a template. ## Link to a page with the form -It's time to open `blog/templates/blog/base.html` in the code editor. In the `div` named `page-header`, we will add a link: +It's time to open `blog/templates/blog/base.html` in the code editor. In the `div` named `container` inside `page-header` `div` tag, we will add a link: {% filename %}blog/templates/blog/base.html{% endfilename %} ```html @@ -68,8 +68,10 @@ After adding the line, your HTML file should now look like this:
@@ -358,7 +360,7 @@ If you need more information about Django forms, you should read the documentati Being able to create new posts by clicking a link is awesome! But right now, anyone who visits your site will be able to make a new blog post, and that's probably not something you want. Let's make it so the button shows up for you but not for anyone else. -Open `blog/templates/blog/base.html` in the code editor, find our `page-header` `div` and the anchor tag you put in there earlier. It should look like this: +Open `blog/templates/blog/base.html` in the code editor, find our `container` `div` inside `page-header` `div` and the anchor tag you put in there earlier. It should look like this: {% filename %}blog/templates/blog/base.html{% endfilename %} ```html diff --git a/en/template_extending/README.md b/en/template_extending/README.md index 2e9a672464b..f33675dbe94 100644 --- a/en/template_extending/README.md +++ b/en/template_extending/README.md @@ -33,7 +33,9 @@ Then open it up in the code editor and copy everything from `post_list.html` to
@@ -61,7 +63,10 @@ Then in `base.html`, replace your whole `` (everything between `` an ```html
From 953131af31f8cc319925426753c689a4a00071d2 Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 16:18:22 +0530 Subject: [PATCH 05/37] Fixed text case inside HTML --- en/css/README.md | 8 ++++---- en/django_templates/README.md | 2 +- en/html/README.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/en/css/README.md b/en/css/README.md index 2a62d2e5d8f..67cf92dcff2 100644 --- a/en/css/README.md +++ b/en/css/README.md @@ -129,7 +129,7 @@ Your file should now look like this: {% for post in posts %}
-

published: {{ post.published_date }}

+

Published: {{ post.published_date }}

{{ post.title }}

{{ post.text|linebreaksbr }}

@@ -197,7 +197,7 @@ And now add a class `post` to your `div` containing a blog post. {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html
-

published: {{ post.published_date }}

+

Published: {{ post.published_date }}

{{ post.title }}

{{ post.text|linebreaksbr }}

@@ -287,7 +287,7 @@ Then surround the HTML code which displays the posts with declarations of classe ```html {% for post in posts %}
-

published: {{ post.published_date }}

+

Published: {{ post.published_date }}

{{ post.title }}

{{ post.text|linebreaksbr }}

@@ -304,7 +304,7 @@ in the `blog/templates/blog/post_list.html` with this: {% for post in posts %}
-

published: {{ post.published_date }}

+

Published: {{ post.published_date }}

{{ post.title }}

{{ post.text|linebreaksbr }}

diff --git a/en/django_templates/README.md b/en/django_templates/README.md index d088a9eaf37..6a07918abc7 100644 --- a/en/django_templates/README.md +++ b/en/django_templates/README.md @@ -53,7 +53,7 @@ It works! But we want the posts to be displayed like the static posts we created {% for post in posts %}
-

published: {{ post.published_date }}

+

Published: {{ post.published_date }}

{{ post.title }}

{{ post.text|linebreaksbr }}

diff --git a/en/html/README.md b/en/html/README.md index 1281e9a771e..6ff7adb91ff 100644 --- a/en/html/README.md +++ b/en/html/README.md @@ -127,13 +127,13 @@ Here's an example of a full template, copy and paste it into `blog/templates/blo
-

published: 14.06.2014, 12:14

+

Published: 14.06.2014, 12:14

My first post

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

-

published: 14.06.2014, 12:14

+

Published: 14.06.2014, 12:14

My second post

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut f.

From f33bce0ccb5c83f369dfa6aa735daa7ef5d31685 Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 16:19:42 +0530 Subject: [PATCH 06/37] Updated example year to 2020 in tutorial --- en/html/README.md | 4 ++-- en/intro_to_command_line/README.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/en/html/README.md b/en/html/README.md index 6ff7adb91ff..0494d39ee9d 100644 --- a/en/html/README.md +++ b/en/html/README.md @@ -127,13 +127,13 @@ Here's an example of a full template, copy and paste it into `blog/templates/blo
-

Published: 14.06.2014, 12:14

+

Published: 14.06.2020, 12:14

My first post

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

-

Published: 14.06.2014, 12:14

+

Published: 14.06.2020, 12:14

My second post

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut f.

diff --git a/en/intro_to_command_line/README.md b/en/intro_to_command_line/README.md index 95976b77522..2b7079fcbdd 100644 --- a/en/intro_to_command_line/README.md +++ b/en/intro_to_command_line/README.md @@ -171,10 +171,10 @@ Music ``` > dir Directory of C:\Users\olasitarska -05/08/2014 07:28 PM Applications -05/08/2014 07:28 PM Desktop -05/08/2014 07:28 PM Downloads -05/08/2014 07:28 PM Music +05/08/2020 07:28 PM Applications +05/08/2020 07:28 PM Desktop +05/08/2020 07:28 PM Downloads +05/08/2020 07:28 PM Music ... ``` > Note: In powershell you can also use 'ls' like on Linux and Mac OS X. @@ -297,7 +297,7 @@ test > cd practice > mkdir test > dir -05/08/2014 07:28 PM test +05/08/2020 07:28 PM test ``` From 63fafac64722d33186b1bf94e709f04b21a92583 Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 17:02:11 +0530 Subject: [PATCH 07/37] Added actions division for alignment --- en/django_forms/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/en/django_forms/README.md b/en/django_forms/README.md index 45ef7b247a9..ec591afc971 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -277,7 +277,9 @@ Open `blog/templates/blog/post_detail.html` in the code editor and add the line {% filename %}blog/templates/blog/post_detail.html{% endfilename %} ```html - +
+ +
``` so that the template will look like this: @@ -288,12 +290,14 @@ so that the template will look like this: {% block content %}
+
+ +
{% if post.published_date %}
{{ post.published_date }}
{% endif %} -

{{ post.title }}

{{ post.text|linebreaksbr }}

From 9389e7c155cc0a2f26c25940aec0ebee335ba6c0 Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 17:15:52 +0530 Subject: [PATCH 08/37] Converted Glyphicon to Bootstrap4 Icons --- en/django_forms/README.md | 32 ++++++++++++++++++++++++-------- en/template_extending/README.md | 4 +++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/en/django_forms/README.md b/en/django_forms/README.md index ec591afc971..8ad0120fe2b 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -48,7 +48,9 @@ It's time to open `blog/templates/blog/base.html` in the code editor. In the `di {% filename %}blog/templates/blog/base.html{% endfilename %} ```html - + + + ``` Note that we want to call our new view `post_new`. The class `"glyphicon glyphicon-plus"` is provided by the bootstrap theme we are using, and will display a plus sign for us. @@ -69,7 +71,9 @@ After adding the line, your HTML file should now look like this: @@ -278,7 +282,9 @@ Open `blog/templates/blog/post_detail.html` in the code editor and add the line {% filename %}blog/templates/blog/post_detail.html{% endfilename %} ```html
- + + +
``` @@ -291,7 +297,9 @@ so that the template will look like this: {% block content %}
- + + +
{% if post.published_date %}
@@ -368,7 +376,9 @@ Open `blog/templates/blog/base.html` in the code editor, find our `container` `d {% filename %}blog/templates/blog/base.html{% endfilename %} ```html - + + + ``` We're going to add another `{% if %}` tag to this, which will make the link show up only for users who are logged into the admin. Right now, that's just you! Change the `` tag to look like this: @@ -376,7 +386,9 @@ We're going to add another `{% if %}` tag to this, which will make the link show {% filename %}blog/templates/blog/base.html{% endfilename %} ```html {% if user.is_authenticated %} - + + + {% endif %} ``` @@ -388,7 +400,9 @@ Open `blog/templates/blog/post_detail.html` in the code editor and find this lin {% filename %}blog/templates/blog/post_detail.html{% endfilename %} ```html - + + + ``` Change it to this: @@ -396,7 +410,9 @@ Change it to this: {% filename %}blog/templates/blog/post_detail.html{% endfilename %} ```html {% if user.is_authenticated %} - + + + {% endif %} ``` diff --git a/en/template_extending/README.md b/en/template_extending/README.md index f33675dbe94..6ea89ca419b 100644 --- a/en/template_extending/README.md +++ b/en/template_extending/README.md @@ -64,7 +64,9 @@ Then in `base.html`, replace your whole `` (everything between `` an From 0f3bb418c103bf5eb3c9c2029885755fe398bac9 Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Thu, 12 Nov 2020 17:32:01 +0530 Subject: [PATCH 09/37] Bootstrap4 Icons Note added --- en/django_forms/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/django_forms/README.md b/en/django_forms/README.md index 8ad0120fe2b..ad682a9aaad 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -53,7 +53,7 @@ It's time to open `blog/templates/blog/base.html` in the code editor. In the `di ``` -Note that we want to call our new view `post_new`. The class `"glyphicon glyphicon-plus"` is provided by the bootstrap theme we are using, and will display a plus sign for us. +Note that we want to call our new view `post_new`. The [svg icon](https://icons.getbootstrap.com/icons/file-earmark-plus/) is provided by the [Bootstrap Icons](https://icons.getbootstrap.com/) and it will display a page icon with plus sign. After adding the line, your HTML file should now look like this: From 8e96d16ff69982b2a58e3ecb37bc6927eb1edd0a Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Wed, 18 Nov 2020 11:24:47 +0530 Subject: [PATCH 10/37] Undone addition of icon in templation extending section --- en/template_extending/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/en/template_extending/README.md b/en/template_extending/README.md index 6ea89ca419b..a1e2e0a7b8b 100644 --- a/en/template_extending/README.md +++ b/en/template_extending/README.md @@ -64,9 +64,6 @@ Then in `base.html`, replace your whole `` (everything between `` an From 16b03c8302a99c0e540a37c325ca237701b3d9ed Mon Sep 17 00:00:00 2001 From: Nikhil John Date: Wed, 18 Nov 2020 12:27:07 +0530 Subject: [PATCH 11/37] Updated SVG usage with include directive --- en/django_forms/README.md | 43 +++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/en/django_forms/README.md b/en/django_forms/README.md index ad682a9aaad..d3fa263c163 100644 --- a/en/django_forms/README.md +++ b/en/django_forms/README.md @@ -55,7 +55,27 @@ It's time to open `blog/templates/blog/base.html` in the code editor. In the `di Note that we want to call our new view `post_new`. The [svg icon](https://icons.getbootstrap.com/icons/file-earmark-plus/) is provided by the [Bootstrap Icons](https://icons.getbootstrap.com/) and it will display a page icon with plus sign. -After adding the line, your HTML file should now look like this: +The addition of SVG code for the icon made it look very complicated. So we can try a different approach to achieve the same result. + +Let's save the svg code in a separate file. Save the following code in the file `blog/templates/blog/icons/add-post.svg` + +{% filename %}blog/templates/blog/icons/add-post.svg{% endfilename %} +```html + +``` + +Now we can use the file inside the base template as follow. + +{% filename %}blog/templates/blog/base.html{% endfilename %} +```html + + {% include './icons/add-post.svg' %} + +``` + +> Note: You can save the svg file in `blog/static/img/icons/` and use `` tag to display svg icon. But this method requires an extra HTTP request to fetch the file from server. So, it will only increase loading time. But in the proposed method, since `` tag is HTML, we can simply include it inside HTML file from server itself using `{% include %}` directive. This approach reduce the page loading time. + +After editing the line, your HTML file should now look like this: {% filename %}blog/templates/blog/base.html{% endfilename %} ```html @@ -72,7 +92,7 @@ After adding the line, your HTML file should now look like this: