Die Wartungsarbeiten sind beendet. Bei Problemen meldet euch im Digitale Infrastruktur-Raum des Hackspace.

Commit aec6bf84 authored by Robert's avatar Robert
Browse files

restore_tags: Add check for non-existent objects

parent 532f3a86
......@@ -38,7 +38,12 @@ class Command(BaseCommand):
for link in links:
content_type = ContentType.objects.get_for_id(link['tagged_type'])
model = content_type.get_object_for_this_type(id=link['tagged'])
try:
model = content_type.get_object_for_this_type(id=link['tagged'])
except:
print('Warning: Tagged object does no longer exist (type {}, id {})'
.format(link['tagged_type'], link['tagged']))
continue
if isinstance(model, Contribution):
model = model.container
elif isinstance(model, Version):
......
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