Created
June 6, 2020 09:30
-
-
Save godfather68/127b3cb79661125c5c028699689b03cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render, get_object_or_404, redirect | |
from .models import Post | |
def all_post(request): | |
return render(request, 'index.html', { | |
'posts': Post.objects.all()[:3] | |
}) | |
def post_detail(request, pk): | |
return render(request, 'detail.html', { | |
'post': get_object_or_404(Post, pk=id) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment