python3 fixes for djsngo admin pages

This commit is contained in:
Philip Sargent 2020-05-31 22:35:36 +01:00
parent c863bf6e1d
commit f949bb8dc0
3 changed files with 5 additions and 4 deletions

View File

@ -157,7 +157,7 @@ class Person(TroggleModel):
notability = Decimal(0) notability = Decimal(0)
max_expo_val = 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 max_expo_val = int(max_expo_year['year__max']) + 1
for personexpedition in self.personexpedition_set.all(): for personexpedition in self.personexpedition_set.all():
@ -232,7 +232,7 @@ class PersonExpedition(TroggleModel):
return res["day_min"] return res["day_min"]
def day_max(self): 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"] return res["day_max"]

View File

@ -3,6 +3,7 @@ import os.path
import re import re
import django.db.models import django.db.models
from django.db.models import Min, Max
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response 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 # From what I can tell, "persons" seems to be the table rows, while "personss" is the table columns. - AC 16 Feb 09
personss = [ ] personss = [ ]
ncols = 4 ncols = 4
nc = (len(persons) + ncols - 1) / ncols nc = int((len(persons) + ncols - 1) / ncols)
for i in range(ncols): for i in range(ncols):
personss.append(persons[i * nc: (i + 1) * nc]) personss.append(persons[i * nc: (i + 1) * nc])

View File

@ -6,7 +6,7 @@
{% block related %} {% block related %}
<h2>Recent Actions</h2> <h2>Recent Actions</h2>
{% load log %} {% load log %}
{% get_admin_log 10 as admin_log %} {% get_admin_log 10 as admin_log for_user 1 %}
{% if not admin_log %} {% if not admin_log %}
<p>No recent actions</p> <p>No recent actions</p>
{% else %} {% else %}