Skip to content

Commit

Permalink
Merge pull request DjangoGirls#1100 from pamelipluas/master
Browse files Browse the repository at this point in the history
Adding a error handling solution in Forms spanish section
  • Loading branch information
aniav authored Sep 1, 2017
2 parents 599d763 + 81458e8 commit 7bae744
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions es/django_forms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ Agrégalo al principio del archivo. Y ahora podemos decir: vé a la página `pos
```python
return redirect('post_detail', pk=post.pk)
```
Si este paso te da un error "NoReverseMatch", es debido a que la url no ha sido nombrada.

En el archivo `blog/urls.py` Cambia lo siguiente:
```python
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail)
```
por
```python
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail, name='post_detail')
```

`post_detail` es el nombre de la vista a la que queremos ir. ¿Recuerdas que esta *view* requiere una variable `pk`? Para pasarlo a las vistas utilizamos `pk=post.pk`, donde `post` es el post recién creado.

Expand Down

0 comments on commit 7bae744

Please sign in to comment.