mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-09-12 01:03:09 +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:
parent
357b794fad
commit
6e020e3cee
1 changed files with 9 additions and 1 deletions
|
@ -74,7 +74,15 @@ def index(request):
|
||||||
reversions = []
|
reversions = []
|
||||||
for revision in revisions :
|
for revision in revisions :
|
||||||
for reversion in revision.version_set.all() :
|
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(
|
reversions.append(
|
||||||
{'id' : revision.id,
|
{'id' : revision.id,
|
||||||
'datetime': revision.date_created.strftime('%d/%m/%y %H:%M:%S'),
|
'datetime': revision.date_created.strftime('%d/%m/%y %H:%M:%S'),
|
||||||
|
|
Loading…
Reference in a new issue