1

I'm trying to add a custom page in django admin.

I wrote code as I've learned, but everytime I try to access the custom page I created, NoReverseMatch exception keeps occuring.

NoReverseMatch at /admin/order/order/date_view/

Reverse for 'app_list' with keyword arguments '{'app_label': ''}' not found. 1 pattern(s) tried: ['admin/(?P<app_label>auth|fcuser|product|order)/$']

I've tried various code I could find online, but none is working.

Following is my code.

class OrderAdmin(admin.ModelAdmin):
    ....
    def get_urls(self):
        urls = super().get_urls()
        # urls = super(OrderAdmin, self).get_urls()

        custom_urls = [
            # path('date_view/', self.admin_site.admin_view(self.custom_date_view))
            # url(r'^date_view/', self.admin_site.admin_view(self.custom_date_view))
            path('date_view/', self.custom_date_view)
        ]

        return custom_urls + urls

    def custom_date_view(self, request):
        context = dict()

        return TemplateResponse(request, 'admin/order_date_view.html', context)

None of the comment solved the issue.

I'd be really grateful if anyone can help me out.

I want my OrderAdmin class keeps inheriting ModelAdmin.

Minsub Yoon
  • 105
  • 2
  • 3
  • 8
  • 1
    Does this answer your question? [What is a NoReverseMatch error, and how do I fix it?](https://stackoverflow.com/questions/38390177/what-is-a-noreversematch-error-and-how-do-i-fix-it) – Ajay Lingayat Jan 10 '21 at 04:12
  • turned out the 'order_date_view' template I was trying to render was extending wrong base template. Not sure as to why it occurred NoReverseMatch, but I'm just glad that this problem is not bothering me anymore. THX! – Minsub Yoon Jan 10 '21 at 07:52

0 Answers0