from django.shortcuts import render_to_response
from django.template import RequestContext
def handler404(request):
response = render_to_response('404.html', {},
context_instance=RequestContext(request))
response.status_code = 404
return response
def handler500(request):
response = render_to_response('500.html', {},
context_instance=RequestContext(request))
response.status_code = 500
return response
x = Model1.object.all()
y = Model2.object.all()
context = {'from_model_one': x ,'from_model_two': y }
{% for a in from_model_one%}
{{a.id}}
{{a.text}}
{% endfor %}
{% for b in from_model_two %}
{{b.id}}
{{b.text}}
{% endfor %}
def foo(request):
messages.success(request, "Huge success!")
return render(request, 'index.html')
{% for message in messages %}
<div class="alert alert-{{ message.tags }}">{{ message }}</div>
{% endfor %}