Commit 6e020e3c authored by Maël Kervella's avatar Maël Kervella Committed by Pierre Cadart

Vérifie que le content_type existe dans un objet Revision

Prévient le cas d'un objet delete mais sans revert l'action
parent 357b794f
......@@ -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'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment