summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKing2018-04-17 06:20:24 +0000
committerGitHub2018-04-17 06:20:24 +0000
commite06c6e81ef80cff3cf1f5a64506ac7d3e317c7fb (patch)
treebcc7d58a52a50cea94276d0d9e4cffe6a78e7cb6
parent4e5a0684ee4f9a1fc25b1b0734c8a49572486674 (diff)
downloadlearn_django-e06c6e81ef80cff3cf1f5a64506ac7d3e317c7fb.tar.gz
learn_django-e06c6e81ef80cff3cf1f5a64506ac7d3e317c7fb.tar.bz2
learn_django-e06c6e81ef80cff3cf1f5a64506ac7d3e317c7fb.zip
Proper formatting
-rw-r--r--tutorial_4_django_views_templates/slides.md26
1 files 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.