diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-04-23 22:42:46 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-04-23 22:42:46 +0300 |
commit | f05e88551751f12277dea7d88755f2b0ed58bf9f (patch) | |
tree | 0d58a136aaaf70702d3953ed56b2eb3043336596 /core/views/logbooks.py | |
parent | 9ead6b00f9cb680e93b5d0526fed56b54dd536fd (diff) | |
download | troggle-f05e88551751f12277dea7d88755f2b0ed58bf9f.tar.gz troggle-f05e88551751f12277dea7d88755f2b0ed58bf9f.tar.bz2 troggle-f05e88551751f12277dea7d88755f2b0ed58bf9f.zip |
workaround security update on distsortreversed
Due to Django security update CVE-2021-45116 which removed the capability of resolving a method in a template when called dictsortreversed
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r-- | core/views/logbooks.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 9695d54..6160de4 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -32,6 +32,9 @@ todo = '''Fix the get_person_chronology() display bug. ''' def notablepersons(request): + def notabilitykey(person): + return person.notability() + persons = Person.objects.all() # From what I can tell, "persons" seems to be the table rows, while "pcols" is the table columns. - AC 16 Feb 09 pcols = [ ] @@ -41,9 +44,11 @@ def notablepersons(request): pcols.append(persons[i * nc: (i + 1) * nc]) notablepersons = [] - for person in Person.objects.all(): - if person.bisnotable(): - notablepersons.append(person) +# Needed recoding because of Django CVE-2021-45116 + for person in persons: + if person.bisnotable(): + notablepersons.append(person) + notablepersons.sort(key=notabilitykey, reverse=True) return render(request,'notablepersons.html', {'persons': persons, 'pcols':pcols, 'notablepersons':notablepersons}) |