From 19c906d97be029ad53b2eded77279a5b5d00807b Mon Sep 17 00:00:00 2001 From: CataX Date: Tue, 8 Sep 2026 10:08:29 +0300 Subject: [PATCH] schimbare history in dashboard --- Z_comenzi.txt | 6 ++++++ equipment/templates/equipment/dashboard.html | 4 +++- equipment/views.py | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Z_comenzi.txt b/Z_comenzi.txt index 6259e5a..b30b260 100644 --- a/Z_comenzi.txt +++ b/Z_comenzi.txt @@ -50,3 +50,9 @@ docker compose exec web python manage.py migrate docker compose exec web python manage.py import_access docker compose exec web python manage.py clear_database + +git add . +git commit -m " -- comentariu -- " +git push + +git pull diff --git a/equipment/templates/equipment/dashboard.html b/equipment/templates/equipment/dashboard.html index 93bb8d1..b985690 100644 --- a/equipment/templates/equipment/dashboard.html +++ b/equipment/templates/equipment/dashboard.html @@ -63,7 +63,9 @@ șters {% endif %}
- {{ record.equipment_code }} + + {{ record.equipment_code|default:record.name }} + {% empty %}
  • Nu există acțiuni recente.
  • diff --git a/equipment/views.py b/equipment/views.py index 7e981e7..049829c 100644 --- a/equipment/views.py +++ b/equipment/views.py @@ -568,10 +568,13 @@ def dashboard_view(request): pc_hist = Computer.history.all()[:10] mon_hist = Monitor.history.all()[:10] per_hist = Peripheral.history.all()[:10] + emp_hist = Employee.history.all()[:10] # Combinăm listele și le sortăm descrescător după data acțiunii (history_date) activity_log = sorted( - chain(pc_hist, mon_hist, per_hist), key=attrgetter("history_date"), reverse=True + chain(pc_hist, mon_hist, per_hist, emp_hist), + key=attrgetter("history_date"), + reverse=True, )[ :10 ] # Păstrăm doar ultimele 10 cele mai recente acțiuni în total