refactored to use a common 'list.html' refactored to allow some modularization (using blocks)
9 lines
281 B
Python
9 lines
281 B
Python
from django.shortcuts import render, redirect
|
|
from .models import Team
|
|
|
|
def root(request):
|
|
return redirect('/teams/list')
|
|
|
|
def list(request):
|
|
teams = Team.objects.all()
|
|
return render(request, 'list.html', {'title': "Teams", 'items': [f"{team.name}" for team in teams]}) |