0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Use os.path.splitext() instead of custom logic

This commit is contained in:
Tim Heap 2015-10-05 13:26:46 +11:00
parent 8bf9851e01
commit 86f6287202

View File

@ -40,11 +40,7 @@ class Document(models.Model, TagSearchable):
@property
def file_extension(self):
parts = self.filename.split('.')
if len(parts) > 1:
return parts[-1]
else:
return ''
return os.path.splitext(self.filename)[1][1:]
@property
def url(self):