📅  最后修改于: 2022-03-11 15:00:44.100000             🧑  作者: Mango
def index(request):
featured = Post.objects.filter(featured=True)
latest = Post.objects.order_by('-timestamp')[0:3]
if request.method == 'POST':
email = request.POST['email']
new_signup = SignUp() #object
new_signup.email = email
new_signup.save()
context = {
'object_list': featured,
'latest': latest
}
return render(request, 'index.html', context)