📜  中等风格的引导模板 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:44.100000             🧑  作者: Mango

代码示例1
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)