Add pdf media filter template tag
This commit is contained in:
parent
82d25810a8
commit
d9ccfa59d3
1 changed files with 18 additions and 0 deletions
|
@ -35,3 +35,21 @@ def is_flash (mime_type):
|
||||||
if valid_type in mime_type:
|
if valid_type in mime_type:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def is_pdf(mime_type):
|
||||||
|
"""
|
||||||
|
A function that takes the mime type as input and returns true if it is an pdf
|
||||||
|
"""
|
||||||
|
valid_pdf_mime_types = [
|
||||||
|
"application/pdf",
|
||||||
|
"application/vnd.cups-pdf",
|
||||||
|
"application/x-pdf",
|
||||||
|
]
|
||||||
|
|
||||||
|
for valid_type in valid_pdf_mime_types:
|
||||||
|
if valid_type in mime_type:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
Loading…
Reference in a new issue