📜  django view - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:33.670000             🧑  作者: Mango

代码示例2
from django.http import HttpResponse #last line below allows MyView.get 
# to return an HttpResponse object 
from django.views import View #View is to become the parent class of MyView

class MyView(View):
    ''' View is the parent class that provides method as_view() to MyView '''
    def get(self, request, *args, **kwargs):
        return HttpResponse('Hello, World!')