7.4 Iterating Towards the New Design
This commit is contained in:
parent
0d2e2de364
commit
e59776035b
@ -28,7 +28,7 @@ class HomePageTest(TestCase):
|
||||
response = self.client.post('/', data={'item_text': 'A new list item'})
|
||||
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response['location'], '/')
|
||||
self.assertEqual(response['location'], '/lists/the-only-list-in-the-world')
|
||||
|
||||
def test_only_saves_items_when_necessary(self):
|
||||
self.client.get('/')
|
||||
|
@ -8,7 +8,7 @@ from lists.models import Item
|
||||
def home_page(request):
|
||||
if request.method == 'POST':
|
||||
Item.objects.create(text=request.POST['item_text'])
|
||||
return redirect('/')
|
||||
return redirect('/lists/the-only-list-in-the-world')
|
||||
|
||||
items = Item.objects.all() # get objects from database (model)
|
||||
return render(request=request,
|
||||
|
Loading…
x
Reference in New Issue
Block a user