mirror of
https://github.com/adrigongv23/G26---Telemetry-Software.git
synced 2026-08-25 11:33:17 +02:00
Creación de index.html y primera creación de la pagina principal
This commit is contained in:
parent
fd1c6250a4
commit
8d3205bf8f
9 changed files with 129 additions and 19 deletions
|
|
@ -1,3 +1,16 @@
|
|||
from django.shortcuts import render
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from temporadas.models import Temporada # Importamos tu modelo Temporada
|
||||
|
||||
# Create your views here.
|
||||
@login_required
|
||||
def dashboard(request):
|
||||
# Buscamos en la base de datos la temporada que tenga actual=True.
|
||||
# Usamos .first() por seguridad para evitar errores si no hubiera ninguna creada todavía.
|
||||
temporada_activa = Temporada.objects.filter(actual=True).first()
|
||||
|
||||
# Metemos los datos en el diccionario de contexto para mandarlos al HTML
|
||||
context = {
|
||||
'temporada_actual': temporada_activa
|
||||
}
|
||||
|
||||
return render(request, 'index.html', context)
|
||||
Loading…
Add table
Add a link
Reference in a new issue