Skip to content

Instantly share code, notes, and snippets.

@felipebastosweb
Created December 8, 2016 23:03
Show Gist options
  • Save felipebastosweb/5838939594f8e7f25739c15317006144 to your computer and use it in GitHub Desktop.
Save felipebastosweb/5838939594f8e7f25739c15317006144 to your computer and use it in GitHub Desktop.
View escola index renderizando o template
from django.http import HttpResponse
from django.template import loader
from .models import Escola, EscolaSegmento, Serie, Turma
def index(request):
escolas = Escola.objects.all()
template = loader.get_template('escola/index.html')
context = {
'escolas' : escolas,
}
return HttpResponse(template.render(context, request))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment