November 2015
Beginner to intermediate
840 pages
26h 30m
English
Post List PageWith our blog app connected via URL configuration, we can now add URL patterns. Let’s start with a list of blog posts.
In /blog/views.py, our function view is straightforward, as you can see in Example 5.49.
Example 5.49: Project Code
1 from django.shortcuts import render 2 3 from .models import Post 4 5 6 def post_list(request): 7 return render( 8 request, 9 'blog/post_list.html', 10 {'post_list': Post.objects.all()})
We wish to list our blog posts at /blog/. However, this is already the URL path matched by our call to include in suorganizer/urls.py. When a user requests /blog/, Django will remove the root ...
Read now
Unlock full access