amend function view to class based view