diff --git a/pypro/modulos/facade.py b/pypro/modulos/facade.py index e22b858..0bf7f11 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 Aula, Modulo 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: str): + 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..9b97617 --- /dev/null +++ b/pypro/modulos/migrations/0006_aula_vimeo_id.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.4 on 2024-04-14 18:50 + +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..d48a61d --- /dev/null +++ b/pypro/modulos/migrations/0007_alter_vimeo_obrigatorio.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.4 on 2024-04-14 18:50 + +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 e21c593..4726adf 100644 --- a/pypro/modulos/models.py +++ b/pypro/modulos/models.py @@ -24,6 +24,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..2b855f9 --- /dev/null +++ b/pypro/modulos/templates/modulos/aula_detalhe.html @@ -0,0 +1,15 @@ +{% extends 'base/base.html' %} +{% block title %}Python Pro - Aperitivo{% endblock title %} +{% block description %}Página com vídeo gratuito de Python{% endblock description %} +{% block body %} +