Consolidated schedule into an events list.

This commit is contained in:
2021-11-14 11:20:57 -06:00
parent cc1421c6e1
commit 1ec7a09620
9 changed files with 85 additions and 48 deletions

View File

@@ -8,14 +8,23 @@ def root(request):
return redirect('/teams/list')
def list(request):
teams = Team.objects.all()
return render(request, 'list.html', {'title': "Players",
'items': [
{'id':team.id,
'title':f"{team.name}"
}
for team in teams],
'edit_url_name': 'edit team'})
items = Team.objects.all()
context = {
'title': "Teams",
'items': [
{'id': item.id,
'title': f"{item.name}",
'buttons': [
{
'label': 'Edit',
'href': reverse('edit team', args=[item.id])
}
]
}
for item in items]
}
return render(request, 'list.html', context)
def edit(request, id=0):
# if this is a POST request we need to process the form data