Answers for "render httpresponse django"

3

django return httpresponse

from django.http import HttpResponse
return HttpResponse('<h1>Hello World</h1>')
Posted by: Guest on May-27-2021
0

render to response django

from django.http import Http404

def my_view(request):
    my_objects = list(MyModel.objects.filter(published=True))
    if not my_objects:
        raise Http404("No MyModel matches the given query.")
Posted by: Guest on September-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language