Show preview of answered images

This commit is contained in:
Raphael Michel
2019-07-16 09:28:16 +02:00
parent fb1f6c65af
commit a79a156a28
3 changed files with 20 additions and 0 deletions

View File

@@ -870,6 +870,10 @@ class QuestionAnswer(models.Model):
return url
return ""
@property
def is_image(self):
return any(self.file.name.endswith(e) for e in ('.jpg', '.png', '.gif', '.tiff', '.bmp', '.jpeg'))
@property
def file_name(self):
return self.file.name.split('.', 1)[-1]