I'm trying to add a custom page to the admin without a model association.
This is what I achieved so far.
class MyCustomAdmin(AdminSite):
def get_urls(self):
from django.conf.urls import url
urls = super(MyCustomAdmin, self).get_urls()
urls += [
url(r'^my_custom_view/$', self.admin_view(MyCustomView.as_view()))
]
return urls
class MyCustomView(View):
template_name = 'admin/myapp/views/my_custom_template.html'
def get(self, request):
return render(request, self.template_name, {})
def post(self, request):
# Do something
pass
admin_site = MyCustomAdmin()
admin_site.register(MyModel1)
admin_site.register(MyModel2)
# etc...
This is actually working but the problem is that with this solution I loose some apps from the Django admin interface (account, auth, socialaccounts, sites).