Skip to content

Commit 59e69a8

Browse files
committed
Fix "Add publish button" and "delete" sections
1 parent efbd006 commit 59e69a8

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

en/homework/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ into these:
8484
{{ post.published_date }}
8585
</div>
8686
{% else %}
87-
<form method="POST" action="{% url post_publish pk=post.pk %} class="post-form">{% csrf_token %}
87+
<form method="POST" action="{% url 'post_publish' pk=post.pk %}" class="post-form">{% csrf_token %}
8888
<button type="submit" class="post btn btn-info" name="publish">Publish</button>
8989
</form>
9090
{% endif %}
@@ -101,7 +101,7 @@ Now, let's take a look at the details of the form. We are using a new attribute,
101101
Time to create a URL (in `blog/urls.py`):
102102

103103
```python
104-
path('post/<pk>/publish/', views.post_publish, name='post_publish'),
104+
path('post/<int:pk>/publish/', views.post_publish, name='post_publish'),
105105
```
106106

107107
and finally, a *view* (as always, in `blog/views.py`):
@@ -137,7 +137,7 @@ Congratulations! You are almost there. The last step is adding a delete button!
137137
Let's open `blog/templates/blog/post_detail.html` once again and add these lines:
138138

139139
```django
140-
<form method="POST" action="{% url post_remove pk=post.pk %} class="post-form">{% csrf_token %}
140+
<form method="POST" action="{% url 'post_remove' pk=post.pk %}" class="post-form">{% csrf_token %}
141141
<button type="submit" class="post btn btn-danger" name="delete">
142142
<span class="glyphicon glyphicon-remove"></span>
143143
</button>
@@ -149,7 +149,7 @@ just under a line with the edit button.
149149
Now we need a URL (`blog/urls.py`):
150150

151151
```python
152-
path('post/<pk>/remove/', views.post_remove, name='post_remove'),
152+
path('post/<int:pk>/remove/', views.post_remove, name='post_remove'),
153153
```
154154

155155
Now, time for a view! Open `blog/views.py` and add this code:

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)