Search code examples
djangoadmindjango-class-based-views

Add django class based view to admin site


I have created some forms using class based views, now I like to add them to the Django Admin site. I have only found this link which describes adding normal views to the Admin site.


Solution

  • as_view() method of class-based view returns regular view so you can call it from ModelAdmin like this:

    def review(self, request, id):
        return MyReviewView.as_view()(request, id)