Skip to content

Commit

Permalink
Merge branch 'master' into add-aws-deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
amakarudze authored Oct 28, 2023
2 parents 116a970 + aee9435 commit cee3ab7
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 244 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Current tutorials are:
- [Homework: create comment model](/en/homework_create_more_models)
- [Optional: PostgreSQL installation](/en/optional_postgresql_installation)
- [Optional: Domain](/en/domain)
- [Deploy your website on Heroku](/en/heroku)

## Contributing

Expand Down
5 changes: 1 addition & 4 deletions en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@
* [Deploy your website on AWS](aws/README.md)
* [Introduction to AWS](aws/intro_to_aws/README.md)
* [Getting started with AWS](aws/getting_started_with_aws/README.md)
* [Deploy to AWS Elastic Beanstalk](aws/aws_elastic_beanstalk/README.md)



* [Deploy to AWS Elastic Beanstalk](aws/aws_elastic_beanstalk/README.md)
217 changes: 0 additions & 217 deletions en/heroku/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions en/homework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Remember the chapter about querysets? We created a view `post_list` that display

Time to do something similar, but for draft posts.

Let's add a link in `blog/templates/blog/base.html` in the header. We don't want to show our list of drafts to everybody, so we'll put it inside the `{% raw %}{% if user.is_authenticated %}{% endraw %}` check, right after the button for adding new posts.
Let's add a link in `blog/templates/blog/base.html` in the header. We don't want to show our list of drafts to everybody, so we'll put it inside the {% raw %}`{% if user.is_authenticated %}`{% endraw %} check, right after the button for adding new posts.

```django
<a href="{% url 'post_draft_list' %}" class="top-menu"><span class="glyphicon glyphicon-edit"></span></a>
Expand Down Expand Up @@ -88,7 +88,7 @@ into these:
{% endif %}
```

As you noticed, we added `{% raw %}{% else %}{% endraw %}` line here. That means, that if the condition from `{% raw %}{% if post.published_date %}{% endraw %}` is not fulfilled (so if there is no `published_date`), then we want to do the line `{% raw %}<a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">Publish</a>{% endraw %}`. Note that we are passing a `pk` variable in the `{% raw %}{% url %}{% endraw %}`.
As you noticed, we added {% raw %}`{% else %}`{% endraw %} line here. That means, that if the condition from {% raw %}`{% if post.published_date %}`{% endraw %} is not fulfilled (so if there is no `published_date`), then we want to do the line {% raw %}`<a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">Publish</a>`{% endraw %}. Note that we are passing a `pk` variable in the {% raw %}`{% url %}`{% endraw %}.

Time to create a URL (in `blog/urls.py`):

Expand Down
14 changes: 10 additions & 4 deletions en/homework_create_more_models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If you type `python manage.py runserver` on the command line and go to [http://1

## Make our comments visible

Go to the `blog/templates/blog/post_detail.html` file and add the following lines before the `{% raw %}{% endblock %}{% endraw %}` tag:
Go to the `blog/templates/blog/post_detail.html` file and add the following lines before the {% raw %}`{% endblock %}`{% endraw %} tag:

```django
<hr>
Expand Down Expand Up @@ -155,7 +155,7 @@ into:
from .models import Post, Comment
```

Now, go to `blog/templates/blog/post_detail.html` and before the line `{% raw %}{% for comment in post.comments.all %}{% endraw %}`, add:
Now, go to `blog/templates/blog/post_detail.html` and before the line {% raw %}`{% for comment in post.comments.all %}`{% endraw %}, add:

```django
<a class="btn btn-default" href="{% url 'add_comment_to_post' pk=post.pk %}">Add comment</a>
Expand Down Expand Up @@ -228,6 +228,8 @@ Yay! Now your readers can let you know what they think of your blog posts!

Not all of the comments should be displayed. As the blog owner, you probably want the option to approve or delete comments. Let's do something about it.

> If you haven't already, you can download all the Bootstrap icons [here](https://github.com/twbs/icons/releases/download/v1.1.0/bootstrap-icons-1.1.0.zip). Unzip the file and copy all the SVG image files into a new folder inside `blog/templates/blog/` called `icons`. That way you can access an icon like `hand-thumbs-down.svg` using the file path `blog/templates/blog/icons/hand-thumbs-down.svg`
Go to `blog/templates/blog/post_detail.html` and change lines:

```django
Expand All @@ -251,8 +253,12 @@ to:
<div class="date">
{{ comment.created_date }}
{% if not comment.approved_comment %}
<a class="btn btn-default" href="{% url 'comment_remove' pk=comment.pk %}"><span class="glyphicon glyphicon-remove"></span></a>
<a class="btn btn-default" href="{% url 'comment_approve' pk=comment.pk %}"><span class="glyphicon glyphicon-ok"></span></a>
<a class="btn btn-default" href="{% url 'comment_remove' pk=comment.pk %}">
{% include './icons/hand-thumbs-down.svg' %}
</a>
<a class="btn btn-default" href="{% url 'comment_approve' pk=comment.pk %}">
{% include './icons/hand-thumbs-up.svg' %}
</a>
{% endif %}
</div>
<strong>{{ comment.author }}</strong>
Expand Down
4 changes: 1 addition & 3 deletions en/optional_postgresql_installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ Remember to change `name` to the user name that you created earlier in this chap

# Installing PostgreSQL package for Python

First, install Heroku Toolbelt from https://toolbelt.heroku.com/ While we will need this mostly for deploying your site later on, it also includes Git, which might come in handy already.

Next up, we need to install a package which lets Python talk to PostgreSQL - this is called `psycopg2`. The installation instructions differ slightly between Windows and Linux/OS X.
We need to install a package which lets Python talk to PostgreSQL - this is called `psycopg2`. The installation instructions differ slightly between Windows and Linux/OS X.

## Windows

Expand Down
4 changes: 2 additions & 2 deletions es/homework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ De esta manera los nuevos post serán guardados como borradores y se podrán rev

Es tiempo de hacer algo similiar, pero con borradores.

Vamos a añadir un enlace en `blog/templates/blog/base.html` en el encabezado. No queremos mostrar nuestro borradores a todo el mundo, entonces vamos a colocarlo dentro de la verificación `{% raw %}{% if user.is_authenticated %}{% endraw %}`, justo después del botón de agregar posts.
Vamos a añadir un enlace en `blog/templates/blog/base.html` en el encabezado. No queremos mostrar nuestro borradores a todo el mundo, entonces vamos a colocarlo dentro de la verificación {% raw %}`{% if user.is_authenticated %}`{% endraw %}, justo después del botón de agregar posts.

```django
<a href="{% url 'post_draft_list' %}" class="top-menu"><span class="glyphicon glyphicon-edit"></span></a>
Expand Down Expand Up @@ -88,7 +88,7 @@ por estas:
{% endif %}
```

Como puedes ver, hemos agregado la línea `{% raw %}{% else %}{% endraw %}`. Esto significa, que la condición de `{% raw %}{% if post.published_date %}{% endraw %}` no es cumplida (entonces no hay `publication_date`), entonces queremos agregar la línea `{% raw %}<a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">Publish</a>{% endraw %}`. Nota que estamos pasando la variable `pk` en el `{% raw %}{% url %}{% endraw %}`.
Como puedes ver, hemos agregado la línea {% raw %}`{% else %}`{% endraw %}. Esto significa, que la condición de {% raw %}`{% if post.published_date %}`{% endraw %} no es cumplida (entonces no hay `publication_date`), entonces queremos agregar la línea {% raw %}`<a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">Publish</a>`{% endraw %}. Nota que estamos pasando la variable `pk` en el {% raw %}`{% url %}`{% endraw %}.

Tiempo de crear una URL (en `blog/urls.py`):

Expand Down
4 changes: 2 additions & 2 deletions es/homework_create_more_models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Si escribes `python manage.py runserver` en la línea de comandos y vas a [http:

## Has tus comentarios visibles

Ve al archivo `blog/templates/blog/post_detail.html` y agrega el siguiente código antes de la etiqueta `{% raw %}{% endblock %}{% endraw %}`:
Ve al archivo `blog/templates/blog/post_detail.html` y agrega el siguiente código antes de la etiqueta {% raw %}`{% endblock %}`{% endraw %}:

```django
<hr>
Expand Down Expand Up @@ -157,7 +157,7 @@ en:
from .models import Post, Comment
```

Ahora vamos a `blog/templates/blog/post_detail.html` y antes de la línea `{% raw %}{% for comment in post.comments.all %}{% endraw %}`, agrega:
Ahora vamos a `blog/templates/blog/post_detail.html` y antes de la línea {% raw %}`{% for comment in post.comments.all %}`{% endraw %}, agrega:

```django
<a class="btn btn-default" href="{% url 'add_comment_to_post' pk=post.pk %}">Add comment</a>
Expand Down
4 changes: 2 additions & 2 deletions ja/homework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Djangoのクエリセットを勉強した章を覚えていますか? `post_lis

ここでは、それと同じようなことをして、草稿が表示されるようにしましょう。

`blog/templates/blog/base.html` のヘッダーにリンクを追加しましょう。草稿の一覧は誰でも見られるようにはしません。なので、 `{% raw %}{% if user.is_authenticated %}{% endraw %}` という条件の確認に続く箇所で、新しい投稿を追加するボタンのすぐ後にリンクを書いてください。
`blog/templates/blog/base.html` のヘッダーにリンクを追加しましょう。草稿の一覧は誰でも見られるようにはしません。なので、 {% raw %}`{% if user.is_authenticated %}`{% endraw %} という条件の確認に続く箇所で、新しい投稿を追加するボタンのすぐ後にリンクを書いてください。

```django
<a href="{% url 'post_draft_list' %}" class="top-menu"><span class="glyphicon glyphicon-edit"></span></a>
Expand Down Expand Up @@ -88,7 +88,7 @@ def post_draft_list(request):
{% endif %}
```

お気づきのように、`{% raw %}{% else %}{% endraw %}` を追加しました。これは、 `{% raw %}{% if post.published_date %}{% endraw %}` という条件が満たされない(記事に `published_date` が無い)ときに、 `{% raw %}<a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">Publish</a>{% endraw %}` を表示する、という意味です。 `{% raw %}{% url %}{% endraw %}` のキーワード引数である `pk` に値を渡していることに注意してください。
お気づきのように、{% raw %}`{% else %}`{% endraw %} を追加しました。これは、 {% raw %}`{% if post.published_date %}`{% endraw %} という条件が満たされない(記事に `published_date` が無い)ときに、 {% raw %}`<a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">Publish</a>`{% endraw %} を表示する、という意味です。 {% raw %}`{% url %}`{% endraw %} のキーワード引数である `pk` に値を渡していることに注意してください。

それでは新しいURLを追加しましょう。( `blog/urls.py` に)

Expand Down
Loading

0 comments on commit cee3ab7

Please sign in to comment.