How would I perform the following using raw SQL in views.py
?
from app.models import Picture
def results(request):
all = Picture.objects.all()
yes = Picture.objects.filter(vote='yes').count()
return render_to_response('results.html', {'picture':picture, 'all':all, 'yes': yes}, context_instance=RequestContext(request))
What would this results
function look like?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…