I am trying to add a date that displays at the top of every page in Django admin but I haven't been able to find any documentation that discusses this. It needs to be a date that populates based on a script that says when the data was last pulled. Would anyone have any ideas on how to do this?
Asked
Active
Viewed 62 times
0
-
Please have a look at https://stackoverflow.com/a/6586068/4151233 and the Django documentation. It describes how you can override/extend the Django template. – Marco Jan 13 '21 at 16:52
2 Answers
0
you can add new field to your model last_edit_at = models.DateTimeField(auto_now=True) and it will be automatically store date and time of last edit here

Таалай Дюшебеков
- 639
- 3
- 13
-
I don't need it as part of a model. I just need it to be in the top corner of every page. – bballboy8 Jan 13 '21 at 16:54
-
but from where you will get date when the data was last pulled? from model? – Таалай Дюшебеков Jan 13 '21 at 16:59
0
in your settings
INSTALLED_APPS = [
'yourapphere', # your app here
'django.contrib.admin', # the admin here
...
]
in yourapp/templates/admin/base_site.html
{% extends "admin/base_site.html" %}
{% block nav-global %}
// your html and js here to make your clock
{% endblock %}

Cesar Abel Ramirez
- 61
- 5