Show More
@@ -6,18 +6,12 b' from random import random' | |||
|
6 | 6 | |
|
7 | 7 | from django.db import models |
|
8 | 8 | |
|
9 |
from boards.models.attachment.viewers import |
|
|
10 | AudioViewer, SvgViewer | |
|
9 | from boards.models.attachment.viewers import get_viewers, AbstractViewer | |
|
10 | ||
|
11 | 11 | |
|
12 | 12 | FILES_DIRECTORY = 'files/' |
|
13 | 13 | FILE_EXTENSION_DELIMITER = '.' |
|
14 | 14 | |
|
15 | VIEWERS = ( | |
|
16 | WebmViewer, | |
|
17 | AudioViewer, | |
|
18 | SvgViewer, | |
|
19 | ) | |
|
20 | ||
|
21 | 15 | |
|
22 | 16 | class AttachmentManager(models.Manager): |
|
23 | 17 | def create_with_hash(self, file): |
@@ -65,7 +59,7 b' class Attachment(models.Model):' | |||
|
65 | 59 | |
|
66 | 60 | def get_view(self): |
|
67 | 61 | file_viewer = None |
|
68 |
for viewer in |
|
|
62 | for viewer in get_viewers(): | |
|
69 | 63 | if viewer.supports(self.mimetype): |
|
70 | 64 | file_viewer = viewer(self.file, self.mimetype) |
|
71 | 65 | break |
General Comments 0
You need to be logged in to leave comments.
Login now