require http method django view

from django.http import HttpResponse
from django.views import View

class MyView(View):
    def get(self, request):
        # Handle GET request
        return HttpResponse('Hello, GET!')

    def post(self, request):
        # Handle POST request
        return HttpResponse('Hello, POST!')

In this example, we define a Django view class called MyView that inherits from django.views.View. Inside the class, we define two methods: get and post, which correspond to the GET and POST HTTP methods respectively. Inside each method, we handle the specific type of request and return an HttpResponse with a simple message.