CBV to FBV

Report a typo

We have the class-based view HelloWorldView. Transform it to helloworld_view, a function-based view that responds only to GET requests

class HelloWorldView(View):
    def get(self, request):
        html = "Hello, World!"
        return HttpResponse(html)
Write a program in Python 3
from django.http import HttpResponse
from django.views import View


def helloworld_view(request):
...
___

Create a free account to access the full topic