From 4aa1f016586b2a554884e2847e36371c6ec62a0c Mon Sep 17 00:00:00 2001 From: Matheus Lopes <96511087+matheuspdf@users.noreply.github.com> Date: Sun, 22 Oct 2023 12:26:03 -0300 Subject: [PATCH] =?UTF-8?q?Criado=20link=20para=20p=C3=A1ginas=20de=20aula?= =?UTF-8?q?s=20close=20#41=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pypro/modulos/facade.py | 6 +++- .../modulos/migrations/0006_aula_vimeo_id.py | 18 +++++++++++ .../0007_alter_vimeo_obrigatorio.py | 18 +++++++++++ pypro/modulos/models.py | 1 + .../templates/modulos/aula_detalhe.html | 18 +++++++++++ .../templates/modulos/modulo_detalhe.html | 2 +- pypro/modulos/tests/test_aula_detalhe.py | 30 +++++++++++++++++++ pypro/modulos/tests/test_modulo_detalhe.py | 5 ++++ pypro/modulos/urls.py | 1 + pypro/modulos/views.py | 5 ++++ 10 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 pypro/modulos/migrations/0006_aula_vimeo_id.py create mode 100644 pypro/modulos/migrations/0007_alter_vimeo_obrigatorio.py create mode 100644 pypro/modulos/templates/modulos/aula_detalhe.html create mode 100644 pypro/modulos/tests/test_aula_detalhe.py diff --git a/pypro/modulos/facade.py b/pypro/modulos/facade.py index b5824a8..0ca6c0e 100644 --- a/pypro/modulos/facade.py +++ b/pypro/modulos/facade.py @@ -1,6 +1,6 @@ from typing import List -from pypro.modulos.models import Modulo +from pypro.modulos.models import Modulo, Aula def listar_modulos_ordenados() -> List[Modulo]: @@ -18,3 +18,7 @@ def encontrar_modulo(slug: str) -> Modulo: def listar_aulas_de_modulo_ordenadas(modulo: Modulo): return list(modulo.aula_set.order_by('order').all()) + + +def encontrar_aula(slug): + return Aula.objects.get(slug=slug) diff --git a/pypro/modulos/migrations/0006_aula_vimeo_id.py b/pypro/modulos/migrations/0006_aula_vimeo_id.py new file mode 100644 index 0000000..f784f2a --- /dev/null +++ b/pypro/modulos/migrations/0006_aula_vimeo_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.6 on 2023-10-21 13:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("modulos", "0005_aula"), + ] + + operations = [ + migrations.AddField( + model_name="aula", + name="vimeo_id", + field=models.CharField(default="1", max_length=32), + ), + ] diff --git a/pypro/modulos/migrations/0007_alter_vimeo_obrigatorio.py b/pypro/modulos/migrations/0007_alter_vimeo_obrigatorio.py new file mode 100644 index 0000000..3ee1841 --- /dev/null +++ b/pypro/modulos/migrations/0007_alter_vimeo_obrigatorio.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.6 on 2023-10-21 13:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("modulos", "0006_aula_vimeo_id"), + ] + + operations = [ + migrations.AlterField( + model_name="aula", + name="vimeo_id", + field=models.CharField(max_length=32), + ), + ] diff --git a/pypro/modulos/models.py b/pypro/modulos/models.py index 9ca57e0..d057570 100644 --- a/pypro/modulos/models.py +++ b/pypro/modulos/models.py @@ -27,6 +27,7 @@ class Aula(OrderedModel): slug = models.SlugField(unique=True) modulo = models.ForeignKey('Modulo', on_delete=models.PROTECT) order_with_respect_to = 'modulo' + vimeo_id = models.CharField(max_length=32) class Meta(OrderedModel.Meta): pass diff --git a/pypro/modulos/templates/modulos/aula_detalhe.html b/pypro/modulos/templates/modulos/aula_detalhe.html new file mode 100644 index 0000000..39fa063 --- /dev/null +++ b/pypro/modulos/templates/modulos/aula_detalhe.html @@ -0,0 +1,18 @@ +{% extends 'base/base.html' %} +{% load static %} +{% block title %}Python Pro - Aperitivo{% endblock title %} +{% block description %}Página com vídeo gratuito de Python{% endblock description %} +{% block body %} +