summaryrefslogtreecommitdiff
path: root/postgresqleu/util/backendviews.py
diff options
context:
space:
mode:
authorMagnus Hagander2023-10-12 21:42:16 +0000
committerMagnus Hagander2023-10-16 20:58:54 +0000
commitde33a5bab3fec671da446ce283cd4c71bcd179b5 (patch)
treec110de3ea20487095500b5fc1db103b96f54f803 /postgresqleu/util/backendviews.py
parent7d09d42f2f04c0420639fc1374111358b54f49c1 (diff)
Pass a hash to use as cache to all backend list display overrides
Diffstat (limited to 'postgresqleu/util/backendviews.py')
-rw-r--r--postgresqleu/util/backendviews.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/postgresqleu/util/backendviews.py b/postgresqleu/util/backendviews.py
index 685320d9..621d39eb 100644
--- a/postgresqleu/util/backendviews.py
+++ b/postgresqleu/util/backendviews.py
@@ -285,9 +285,10 @@ def backend_list_editor(request, urlname, formclass, resturl, allow_new=True, al
else:
raise Http404()
+ cache = {}
values = [{
'id': o.pk,
- 'vals': [getattr(o, '_display_{0}'.format(f), getattr(o, f)) for f in formclass.list_fields],
+ 'vals': [getattr(o, '_display_{0}'.format(f))(cache) if hasattr(o, '_display_{0}'.format(f)) else getattr(o, f) for f in formclass.list_fields],
'rowclass': formclass.get_rowclass(o),
} for o in objects]
@@ -466,7 +467,8 @@ def backend_handle_copy_previous(request, formclass, restpieces, conference):
objects = formclass.Meta.model.objects.filter(conference=sourceconf)
if formclass.queryset_extra_fields:
objects = objects.extra(select=formclass.queryset_extra_fields)
- values = [{'id': o.pk, 'vals': [getattr(o, '_display_{0}'.format(f), getattr(o, f)) for f in formclass.list_fields]} for o in objects]
+ cache = {}
+ values = [{'id': o.pk, 'vals': [getattr(o, '_display_{0}'.format(f))(cache) if hasattr(o, '_display_{0}'.format(f)) else getattr(o, f) for f in formclass.list_fields]} for o in objects]
return render(request, 'confreg/admin_backend_list.html', {
'conference': conference,
'basetemplate': 'confreg/confadmin_base.html',