from django.http import HttpResponse
from .models import signUp
from django .template import loader
def index(request):
template = loader.get_template("Signup/signup.html")
context = {
'all_users': all_users,
}
return HttpResponse(template.render(context, request))
答案 0 :(得分:1)
all_users 应该是要在上下文中传递的 User 对象的查询集。 试试这个
from django.contrib.auth.models import User
all_users = User.objects.all()
然后在上下文中传递它
context = {
'all_users': all_users,
}