How to fetch data remotely for displaying into admin/index.html in django adminlte v3
In Django AdminLte3, I want to show custom dashboard along with others Admin models. The data of the dashboard will come from remote server. And my custom dashboard will open by localhost:8000/admin/. How can I achieve this. Thanks in advance for any suggestion.
On your url define a new entry to a view:
urls.py
path('admin_dashboard/',admin_dashboard,name='admin_dashboard'),
views.py
@staff_member_required
def admin_dashboard(request):
from django.contrib import admin
context={}
#this makes the menu appear
context['available_apps']=admin.site.get_app_list(request)
return render(request,'admin/admin_dashboard.html',context)
On your settings (assuming you are using adminlte from jazzband):
JAZZMIN_SETTINGS = {
...
"topmenu_links": [
# Url that gets reversed (Permissions can be added)
{"name": "Home", "url": "index",},
{"name": "Dashboard", "url": "admin_dashboard", },
],
...
This will make the link appear on top of the admin page, now its a regular view and a regular template and you can take it from there