How to display file extension in django template ?
485 views
Skip to first unread message
Ashish Tiwari
unread,
Feb 7, 2014, 2:25:10 AM2/7/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
It's a simple question but i'm not able to find easily. How can I display the file extension of uploaded file in template ?
ex : uploaded-filename.jpeg
{{file.<extension>}} will display "jpeg" in template.
Russell Keith-Magee
unread,
Feb 7, 2014, 9:26:06 AM2/7/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django Users
There isn't anything builtin to do this, but it would be a really to write a custom template tag that was a simple wrapper around os.path.splitext(). See: