Skip to content

Commit cc6cfa6

Browse files
committed
Fix 'NoneType' object has no attribute 'name' on export
When a team is deleted, its image sets are kept, but the team is changed to None. When the annotations of the set are exported, the team name is accessed which results in the above mentioned error. Now, the team name will be replaced with an empty string if the team is None.
1 parent 6a4e5e0 commit cc6cfa6

File tree

1 file changed

+3
-3
lines changed
  • imagetagger/imagetagger/annotations

1 file changed

+3
-3
lines changed

imagetagger/imagetagger/annotations/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ def export_format(export_format_name, imageset):
234234

235235
placeholders_filename = {
236236
'%%imageset': imageset.name,
237-
'%%team': imageset.team.name,
237+
'%%team': imageset.team.name if imageset.team else 'DELETED',
238238
'%%setlocation': imageset.location,
239239
}
240240
for key, value in placeholders_filename.items():
241-
file_name = file_name.replace(key, str(value))
241+
file_name = file_name.replace(key, str(value))
242242

243243
min_verifications = export_format.min_verifications
244244
annotation_counter = 0
@@ -422,7 +422,7 @@ def export_format(export_format_name, imageset):
422422
'%%content': formatted_content,
423423
'%%imageset': imageset.name,
424424
'%%setdescription': imageset.description,
425-
'%%team': imageset.team.name,
425+
'%%team': imageset.team.name if imageset.team else 'DELETED',
426426
'%%setlocation': imageset.location,
427427
}
428428
for key, value in placeholders_base.items():

0 commit comments

Comments
 (0)