0

I have my own HTML page "stat.html" which shows some graphs, this is hyperlinked from a custom index page that I made using this method answer3. My current admin/custom_admin.html page looks like this

{% extends "admin/index.html" %}

{% block content %}
{{block.super}}
<div class="module">
  <table style="width:100%">
    <caption>
      <a class="section">Statistics </a>
    </caption>
    <tbody>
    <th scope="row">
      <a href="/myapp/statpage" class="model">Stats Page</a>
    </th>
  </tbody>
  </table>
</div>
{% endblock %}

The link /myapp/statpage is link to a static html page, it is showing two google charts in it, something like this

{% load static %}

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>Stats</title>
<script src = 
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> 
</script>
<script type = "text/javascript" src = 
"https://www.gstatic.com/charts/loader.js"> </script>
<script type = "text/javascript"> google.charts.load('current', 
{packages: ['corechart']}); </script>
<script src="{% static "v_stats.js" %}"></script>
</head>

<body>
    <div id="container" style="width:80%; height:35vw; margin:"auto";"></div>
    <div id="container1" style="width:80%; height:35vw; margin:"auto";"></div>
</body>

</html> 

How do I just inherit the Django admin header in this stat.html page and have my own title, some links to static js pages and some content in it?

Cloverr
  • 208
  • 3
  • 12
  • You might want to elaborate a bit more on what exactly you want to achieve. Anyways a possible solution is for you to replace any block you don't want with an empty block – Resley Rodrigues May 24 '18 at 09:03
  • You’re asking about stat.html template but showing us your index template. Anyway you can extend `admin/base_site.html` for a basic admin page – dirkgroten May 24 '18 at 09:09
  • @dirkgroten I added it now – Cloverr May 24 '18 at 09:18

1 Answers1

0
from myproject.admin import admin_site
admin.site.site_header = 'My administration'

You may now wish to use this elsewhere in your site, by inserting it as context into your templates.

Ryan
  • 427
  • 2
  • 15
  • I couldn't follow you, the admin site header is used for changing the header in django admin I know, but how does that help me inherit the header. Can you elaborate a bit more with an concrete example – Cloverr May 25 '18 at 08:52