8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 01:13:46 +00:00

Vérifie que le content_type existe dans un objet Revision

Prévient le cas d'un objet delete mais sans revert l'action
This commit is contained in:
Maël Kervella 2017-09-10 15:03:58 +00:00 committed by Pierre Cadart
parent 357b794fad
commit 6e020e3cee

View file

@ -74,7 +74,15 @@ def index(request):
reversions = []
for revision in revisions :
for reversion in revision.version_set.all() :
if reversion.content_type.name in ['ban', 'whitelist', 'vente', 'cotisation', 'interface', 'user'] :
content = ''
try :
content = reversion.content_type.name
except :
# If reversion has no content_type (when object has been deleted)
pass
if content in ['ban', 'whitelist', 'vente', 'cotisation', 'interface', 'user'] :
reversions.append(
{'id' : revision.id,
'datetime': revision.date_created.strftime('%d/%m/%y %H:%M:%S'),