cbv_as_view.py 389 B

12345678910111213141516171819
  1. from django.http import HttpResponse
  2. from django.urls import path
  3. from django.views import View
  4. class EmptyCBV(View):
  5. pass
  6. class EmptyCallableView:
  7. def __call__(self, request, *args, **kwargs):
  8. return HttpResponse()
  9. urlpatterns = [
  10. path('missing_as_view', EmptyCBV),
  11. path('has_as_view', EmptyCBV.as_view()),
  12. path('callable_class', EmptyCallableView()),
  13. ]