From e06c6e81ef80cff3cf1f5a64506ac7d3e317c7fb Mon Sep 17 00:00:00 2001 From: King Date: Tue, 17 Apr 2018 06:20:24 +0000 Subject: Proper formatting --- tutorial_4_django_views_templates/slides.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tutorial_4_django_views_templates/slides.md b/tutorial_4_django_views_templates/slides.md index 4cf77c6..5880676 100644 --- a/tutorial_4_django_views_templates/slides.md +++ b/tutorial_4_django_views_templates/slides.md @@ -56,13 +56,13 @@ Demonstration [02:50 | 05:42] - Create ```urls.py``` in blog app - from django.urls import path - from . import views + from django.urls import path + from . import views - app_name = 'blog' - urlpatterns = [ - path('', views.index, name='index'), - ] + app_name = 'blog' + urlpatterns = [ + path('', views.index, name='index'), + ] Now change the ```/myproject/urls.py``` so that the project knows which urls file to call @@ -97,7 +97,6 @@ In the /blog/views.py edit get_blogs function return HttpResponse(blogs) - Narrator Notes: Please state that Django queries will be explained later in the series. -- Show the blog in the output created in previous tutorial - Let us append the url to the urlpatterns in ```blog/urls.py``` @@ -108,15 +107,16 @@ In the /blog/views.py edit get_blogs function ] - Go to the url http://localhost:8000/blogs/get_blogs and show the output. + - Show the blog in the output created in previous tutorial - Improving the output - def get_blogs(request): - blogs = Blog.objects.all() # This is called a query - response = 'Blogs:' - for blog in blogs: - response += '<\ br> {0} '.format(blog) - return HttpResponse(response) + def get_blogs(request): + blogs = Blog.objects.all() # This is called a query + response = 'Blogs:' + for blog in blogs: + response += '<\ br> {0} '.format(blog) + return HttpResponse(response) - Narrator Notes: Should explain the above code. - Save and again show the browser. -- cgit