Django custom view into admin page

后端 未结 4 730
夕颜
夕颜 2021-01-31 03:51

I have created a custom view.

How can I insert the view into the admin?

For a normal admin class, we can just simply register it to the admin site:



        
4条回答
  •  攒了一身酷
    2021-01-31 04:34

    Based on the information you provided you should check this part of Django's documentation:

    Adding views to admin sites (note: the link is valid for version 1.5 since version 1.3 is not supported anymore - the solution is still valid).

    Then you could check this blog post and this question for some further inspiration and details.


    Based on your example I really don't get why you just don't use a regular ModelAdmin with some filtering options:

    class QuestionAdmin(admin.ModelAdmin):
        list_filter = ('topic',)
    

提交回复
热议问题