Skip to content

Commit

Permalink
Breadcrumb e correção de ineficiência close #43
Browse files Browse the repository at this point in the history
  • Loading branch information
matheuspdf committed Oct 31, 2023
1 parent 68ab6ec commit 736dde2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pypro/modulos/facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def listar_aulas_de_modulo_ordenadas(modulo: Modulo):


def encontrar_aula(slug):
return Aula.objects.get(slug=slug)
return Aula.objects.select_related('modulo').get(slug=slug)
9 changes: 8 additions & 1 deletion pypro/modulos/templates/modulos/aula_detalhe.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
{% block title %}Python Pro - Aperitivo{% endblock title %}
{% block description %}Página com vídeo gratuito de Python{% endblock description %}
{% block body %}
<div class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="{{aula.modulo.get_absolute_url}}">{{aula.modulo.titulo}}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{aula.titulo}}</li>
</ol>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="mt-4 mb-3">{{ aula.titulo | default:"Título não encontrado" }}</h1>
Expand Down
4 changes: 4 additions & 0 deletions pypro/modulos/tests/test_aula_detalhe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ def test_titulo(resp, aula: Aula):

def test_vimeo(resp, aula: Aula):
assert_contains(resp, f'src="https://player.vimeo.com/video/{ aula.vimeo_id }"')


def test_modulo_breadcrumb(resp, modulo: Modulo):
assert_contains(resp, f'<li class="breadcrumb-item"><a href="{modulo.get_absolute_url()}">{modulo.titulo}</a></li>')

0 comments on commit 736dde2

Please sign in to comment.