in apps.dashboard.tests & .urls, adding a new to-do item to the input field in either home.html or a blank-tabled list.html points to /apps/dashboard/newlist; in .views, home_page() FBV simplified to a mere html page render & new_list() FBV added that currently points to the global list

This commit is contained in:
Disco DeDisco
2026-01-02 21:50:37 -05:00
parent 87e40d977c
commit b4b2b43475
5 changed files with 22 additions and 26 deletions

View File

@@ -2,13 +2,12 @@ from django.shortcuts import redirect, render
from .models import Item
def home_page(request):
if request.method == 'POST':
Item.objects.create(text=request.POST['item_text'])
return redirect('/apps/dashboard/the-only-list-in-the-world/')
items = Item.objects.all()
return render(request, 'apps/dashboard/home.html', {'items': items})
return render(request, 'apps/dashboard/home.html')
def view_list(request):
items = Item.objects.all()
return render(request, 'apps/dashboard/list.html', {'items': items})
return render(request, 'apps/dashboard/list.html', {'items': items})
def new_list(request):
Item.objects.create(text=request.POST['item_text'])
return redirect('/apps/dashboard/the-only-list-in-the-world/')