0
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)
U13-Forward
  • 69,221
  • 14
  • 89
  • 114

1 Answers1

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