Skip to content

Commit

Permalink
test reverse to user tutoriel guide
Browse files Browse the repository at this point in the history
  • Loading branch information
hadpro24 committed Jul 26, 2021
1 parent 25dabb9 commit e317fbc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions examples/awesome_app/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@
},
]

@router('/')
def home(request):
return render('awesome_app/home.html')

@router('/films')
@router('/', name='home')
def home(request):
search = request.GET.get('search', '')
films_filter = [
Expand All @@ -61,7 +57,7 @@ def home(request):
}
return render('awesome_app/list_films.html', contexts)

@router('/films/<int:id>', methods=['GET', 'POST'])
@router('/films/<int:id>', methods=['GET', 'POST'], name='film')
def film_detail(request, id):
film = {
'data': film for film in films if film['id'] == id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div class="contenair">
<div class="data-film">
<div class="info">
<a href="/films">Back to list</a>
<a href="{{ reverse('home') }}">Back to list</a>
<h1>{{ film.title }}</h1>
<p>
{{ film.description }}
Expand Down
2 changes: 1 addition & 1 deletion examples/awesome_app/templates/awesome_app/list_films.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>List films</h1>
<h3>{{ film.title }}</h3>
<h5><strong><em>Year of production : </em></strong>{{ film.released }}</h5>
<div class="button-two">
<a type="button" class="button-favoir-and-details" href="/films/{{ film.id }}">Details</a>
<a type="button" class="button-favoir-and-details" href="{{ reverse('film', id=film.id) }}">Details</a>
</div>
</div>
</div>
Expand Down

0 comments on commit e317fbc

Please sign in to comment.