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.