from django.shortcuts import render
from .models import Post
def post_list_view(request):
post_objects = Post.objects.all()
context = {
'post_objects' : post_objects
}
return render(request, "posts/index.html", context)
Asked
Active
Viewed 34 times
0
U12-Forward
- 65,118
- 12
- 70
- 89
-
1Indent your `return` into your function... – U12-Forward Aug 17 '21 at 07:13
1 Answers
1
The return should be inside the function. At the same indent than the rest of the function
from django.shortcuts import render
from .models import Post
def post_list_view(request):
post_objects = Post.objects.all()
context = {
'post_objects' : post_objects
}
return render(request, "posts/index.html", context)
JuR
- 113
- 4