Do not crash on missing owner

This commit is contained in:
Alexandre Iooss 2021-10-15 09:21:14 +02:00
parent 2200b0d436
commit d95f29c870

View file

@ -58,7 +58,7 @@ class CustomGalleryDetailView(DetailView):
# List owners
context['owners'] = []
for photo in context['photos']:
if photo.extended.owner not in context['owners']:
if hasattr(photo, 'extended') and photo.extended.owner not in context['owners']:
context['owners'].append(photo.extended.owner)
# Filter on owner