From f949bb8dc0d5c5e6c37a5464a8e67d6c5fc8c254 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 31 May 2020 22:35:36 +0100 Subject: [PATCH] python3 fixes for djsngo admin pages --- core/models.py | 4 ++-- core/views_logbooks.py | 3 ++- templates/frontpage.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/models.py b/core/models.py index 4d69481..9414e58 100644 --- a/core/models.py +++ b/core/models.py @@ -157,7 +157,7 @@ class Person(TroggleModel): notability = Decimal(0) max_expo_val = 0 - max_expo_year = Expedition.objects.all().aggregate(Max('year')) + max_expo_year = Expedition.objects.all().aggregate(models.Max('year')) max_expo_val = int(max_expo_year['year__max']) + 1 for personexpedition in self.personexpedition_set.all(): @@ -232,7 +232,7 @@ class PersonExpedition(TroggleModel): return res["day_min"] def day_max(self): - res = self.persontrip_set.all().aggregate(day_max=Max("expeditionday__date")) + res = self.persontrip_set.all().aggregate(day_max=models.Max("expeditionday__date")) return res["day_max"] diff --git a/core/views_logbooks.py b/core/views_logbooks.py index 1cb9f2c..53333fb 100644 --- a/core/views_logbooks.py +++ b/core/views_logbooks.py @@ -3,6 +3,7 @@ import os.path import re import django.db.models +from django.db.models import Min, Max from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render, render_to_response @@ -49,7 +50,7 @@ def personindex(request): # From what I can tell, "persons" seems to be the table rows, while "personss" is the table columns. - AC 16 Feb 09 personss = [ ] ncols = 4 - nc = (len(persons) + ncols - 1) / ncols + nc = int((len(persons) + ncols - 1) / ncols) for i in range(ncols): personss.append(persons[i * nc: (i + 1) * nc]) diff --git a/templates/frontpage.html b/templates/frontpage.html index c0aea50..a11b6f7 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -6,7 +6,7 @@ {% block related %}

Recent Actions

{% load log %} - {% get_admin_log 10 as admin_log %} + {% get_admin_log 10 as admin_log for_user 1 %} {% if not admin_log %}

No recent actions

{% else %}